仅在Android内置图库中打开图像

时间:2011-08-19 09:42:24

标签: android image gallery

我只需在内置图库中打开图像,没有意图选择器。 如果我使用ACTION_VIEW,我会自动获得选择器。

有没有办法做到这一点?

TX,

3 个答案:

答案 0 :(得分:3)

这会打开图库(不是选择器)。在Galacxy S上测试Android 2.3.3

Intent intent = new Intent(Intent.ACTION_VIEW,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);

答案 1 :(得分:1)

内置图库可以像这样打开:

Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);

答案 2 :(得分:0)

您是否尝试过使用Intent.setClassName?然后,您可以指定图库意图并完全绕过选择器。

final Intent intent = new Intent(); intent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.Gallery"); startActivity(intent);

将在Samsung Galaxy Nexus Android 4.0 Jelly Bean上启动图库应用程序。在三星Galaxy S2上,它是"com.cooliris.media", "com.cooliris.media.Gallery"。你必须找出特定手机的班级名称,因为它对于任何给定的手机都是不同的。

相关问题