Nouvel Travay Nouvel Travay - 7 months ago 216
Android Question

Convert Map to Bundle in android

Is there an easy way to convert a Map to a Bundle in android without explicit iteration?


Firebase returns a Map for Notification

. I need to pass the data to an intent. Formerly GCM gave me a bundle, so I didn't need to worry about this.


I guess a good old fashioned for loop is the easiest way:

    Bundle bundle = new Bundle();
    for (Map.Entry<String, String> entry : getData().entrySet()) {
        bundle.putString(entry.getKey(), entry.getValue());