Convert Map<String, String> Collection To Bundle - Android android.os

Android examples for android.os:Bundle

Description

Convert Map<String, String> Collection To Bundle

Demo Code

import android.os.Bundle;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Main{

    public static Bundle mapToBundle(Map<String, String> map) {
        Bundle bundle = new Bundle();
        for (String key : map.keySet()) {
            bundle.putString(key, map.get(key));
        }/*  w w  w.j  av  a  2  s .c  om*/
        return bundle;
    }

}

Related Tutorials