简体   繁体   中英

Open image in android Built-In Gallery only

i need to open an image in the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM