Tuesday, December 14, 2010

[android-developers] Choose Camera or Gallery Activity

Hi Everyone,

I'm trying to get Android to create the default "Choose Activity"
dialog with the options of the built-in Camera application and the
built-in Gallery application. However, I can't seem to figure out how
to do it. I was trying to use ACTION_PICK_ACTIVITY but that wasn't
working because I can only specify one EXTRA_INTENT. Am I on the
right track or am I completely off the mark?

Here's the nonworking code:

Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Intent galleryIntent = new Intent(Intent.ACTION_PICK);
galleryIntent.setType("image/*");

Intent findImageIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
findImageIntent.putExtra(Intent.EXTRA_INTENT, captureIntent);
findImageIntent.putExtra(Intent.EXTRA_INTENT, galleryIntent); //
Overwrites the captureIntent

startActivityForResult(Intent.createChooser(findImageIntent, "Select
Picture"), 1);


Any help would be appreciated. Thanks :D

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment