2

Is there a way to know what all extra-keys are applicable to a particular intent? For example if i create an intent,

Intent cropIntent = new Intent("com.android.camera.action.CROP");

then the following putExtra calls are some that are applicable.

cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);

So how can I get the list of all the extra-keys that are related to the intent?

Aj_
  • 494
  • 4
  • 13
  • 2
    Look here, http://stackoverflow.com/questions/5968896/listing-all-extras-of-an-intent Do a search before posting a question. – Hades Apr 28 '14 at 04:04
  • 2
    @Hades - That question considers the inverse problem: given an intent, what extras are in it? OP is asking about how to know what extras are meaningful to put into an intent in the first place. – Ted Hopp Apr 28 '14 at 04:21
  • 1
    @Hades No that's not what I want. That code lists the extras I have already put into the intent. What i want is a method to list all the possible keys that I can put into the intent. – Aj_ Apr 28 '14 at 04:23

1 Answers1

4

Generally, the only way to know what extras are supported is to look at the documentation for the action. If the source code is available, that's the only other way to know.

In your particular example, unofficial documentation can be found here. The source code happens to be available here. Look in CropExtras.java for the available keys and dig through CropActivity.java for how they are used. However, note that using com.android.camera.action.CROP is probably not a good idea, as explained in this blog post and in the answer in this thread.

Community
  • 1
  • 1
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • Thanks for the answer. That blog post was helpful as well. Now I know why the android developer documentation doesn't have any info regarding those constants. – Aj_ Apr 28 '14 at 04:43
  • @TedHopp, nice and informative answer as usual. Keep the good work up.+1 definitely. – Ritesh Gune Apr 28 '14 at 05:14