I'm having a heck of a time figuring out what data is coming to my methods through Intent
/Bundle
s. I've tried adding break points to inspect the data, but I don't see anything. Perhaps because it's a Parcelable
I can't manually read it in Eclipse.
For instance, a onActivityResult(int requestCode, int resultCode, Intent data)
for a Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI)
. How do I know what data is available? Notice, I'm not ask for WHAT data is available but how the heck do I figure it out so I can apply the same idea to any Bundle
/Intent
from the Android framework? Perhaps it's a simple as looking at the docs, but I don't see a full listing of the data and I can't see it in Eclipse. So I'm at a lost.
Bundle is used to pass data between Activities. You can create a bundle, pass it to Intent that starts the activity which then can be used from the destination activity.
Bundles are generally used for passing data between various Android activities. It depends on you what type of values you want to pass, but bundles can hold all types of values and pass them to the new activity.
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.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With