【问题标题】:How to pick images from Gallery instead of Photos in android?如何从画廊而不是android中的照片中选择图像?
【发布时间】:2015-02-11 06:31:56
【问题描述】:

我正在使用以下代码来挑选图像。

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
    photoPickerIntent.setType("image/*");
    photoPickerIntent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(Intent.createChooser(photoPickerIntent, getActivity().getResources().getString(R.string.select_picture)), 1);

它工作正常,但它只让我从默认的照片应用程序中选择图像。即使在当今最新的设备中,我也想从“图库”应用程序中挑选图像。即使对于 Lollipop,我也不知道 WhatsApp 是如何做到这一点的。

【问题讨论】:

    标签: android android-intent android-camera-intent


    【解决方案1】:

    我在我的应用程序中使用此代码,它对我来说很好..

    intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            intent.setType("image/* video/*");
            startActivityForResult(intent, 3);
    

    【讨论】:

    • 它会从 Google plus 启动 Gallery App 或 Photos App 吗?
    • 在模拟器库中存在。所以它会启动 Gallery 应用程序。
    • 实际上我的问题是,照片​​应用程序也显示了缓存目录中的一些图像,我不想被看到。图库应用程序不这样做。
    • 如果没有图库应用怎么办。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-20
    • 2021-10-24
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    • 2013-07-30
    • 1970-01-01
    相关资源
    最近更新 更多