I am trying to pass arbitrary data to a BroadcastReceiver through its Intent.
So I might do something like the following
intent.putExtra("Some boolean", false);
intent.putExtra("Some char", 'a');
intent.putExtra("Some String", "But don't know what it will be");
intent.putExtra("Some long", 15134234124125);
And then pass this to the BroadcastReceiver
I want to iterate through Intent.getExtras() with something like keySet(), but I would also like to be able to get the value of the key without having to hard-code calls to methods like .getStringExtra(), or .getBooleanExtra().
How does a person do this?
You can use the following code to get an object of any time from the
Intent:Then you can determine
value‘s real type usingObject‘s methods.