Inspect intents at runtime?
I'm interested in inspecting an Intent
(namely it's extras) that gets logged like this:
01-05 13:00:29.192: INFO/ActivityManager(74): Starting activity: Intent { dat=content://media/external/images/media/29 cmp=com.android.camera/.ViewImage (has extras) }
Is there a开发者_如何转开发ny standard way to do it?
The only option I can think so far is writing a customIntentFilter
to catch it.Yeah, to be able to see the extras, a custom intent filter would be the only thing I can think of that would allow you to inspect them at runtime. You can look at the Android source to find out what extras are accepted by different activities.
Use something along the lines of:
Bundle bundle = intent.getExtras();
for (String key : bundle.keySet()){
Log.d("Foo", "Extra " + key + " -> " + bundle.get(key));
}
精彩评论