How do I know what data is given in a Bundle?

Solution 1:

Bundle.keySet() gives you a list of all keys in the bundle. That said, typically you just expect certain keys and query them, but keySet() is used to examine bundles you get from somewhere.

Solution 2:

public static String bundle2string(Bundle bundle) {
    if (bundle == null) {
        return null;
    }
    String string = "Bundle{";
    for (String key : bundle.keySet()) {
        string += " " + key + " => " + bundle.get(key) + ";";
    }
    string += " }Bundle";
    return string;
}

Solution 3:

i getting alll key and value of bundle stored...

for (String key : bundle.keySet()) {
    string += " " + key + " => " + bundle.get(key) + ";";
}

output:

(key)       :(value)    
profile_name:abc