i need to open an image in the 开发者_JAVA技巧built in gallery only, with no intent chooser. if i use ACTION_VIEW, i automatically get the chooser.
is there any way to do this?
Tx,
This opens the Gallery (not the picker). Tested on Android 2.3.3 on a Galacxy S
Intent intent = new Intent(Intent.ACTION_VIEW,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);
Built-in gallery can be opened like this:
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);
Have you tried using Intent.setClassName
? You could then specify the gallery intent and bypass the chooser entirely.
final Intent intent = new Intent();
intent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.Gallery");
startActivity(intent);
would start the gallery application on a Samsung Galaxy Nexus Android 4.0 Jelly Bean. On a Samsung Galaxy S2, it's "com.cooliris.media", "com.cooliris.media.Gallery"
instead. You would have to find out the class name for the specific phone, since it is different for any given phone.
精彩评论