Android目标专辑库

时间:2012-10-17 17:20:18

标签: android android-intent gallery

我想对画廊做一个拍照的意图。很容易找到很多这样做的例子,但我想直接在我自己的相册中打开画廊。这可能吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试这样做:

private static final int SELECT_PICTURE = 1;

// ... 

Intent in = new Intent();
in.setType("image/*");
in.setAction(Intent.ACTION_GET_CONTENT);

Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

String pickTitle = "Select or take a new Picture"; // Or get from strings.xml
Intent chooserIntent = Intent.createChooser(in, pickTitle);
chooserIntent.putExtra
(
  Intent.EXTRA_INITIAL_INTENTS, 
  new Intent[] { takePhotoIntent }
);

startActivityForResult(chooserIntent, SELECT_PICTURE);