【发布时间】:2012-11-08 22:52:58
【问题描述】:
我只需要在内置图库中打开一个图像,没有意图选择器。 如果我使用 ACTION_VIEW,我会自动获得选择器。
有什么办法吗?
发送,
【问题讨论】:
我只需要在内置图库中打开一个图像,没有意图选择器。 如果我使用 ACTION_VIEW,我会自动获得选择器。
有什么办法吗?
发送,
【问题讨论】:
这将打开图库(而不是选择器)。在 Galacxy S 上在 Android 2.3.3 上测试
Intent intent = new Intent(Intent.ACTION_VIEW,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);
【讨论】:
内置图库可以这样打开:
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 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"。您必须找出特定手机的类名,因为它对于任何给定的手机都是不同的。
【讨论】: