【问题标题】:Android intent album galleryAndroid Intent 相册库
【发布时间】:2012-10-18 01:39:51
【问题描述】:

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

【问题讨论】:

    标签: android android-intent gallery


    【解决方案1】:

    您可以尝试这样做:

    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);
    

    【讨论】:

    • 谢谢,这行得通,但我想直接访问画廊,但在我自己的文件夹中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-22
    • 1970-01-01
    • 2012-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多