如何以编程方式关闭默认库? [英] How to close default gallery programmatically?

查看:84
本文介绍了如何以编程方式关闭默认库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码

    Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    photoPickerIntent.setType("image/*");
    photoPickerIntent.setAction(Intent.ACTION_GET_CONTENT);
    photoPickerIntent.addCategory(Intent.CATEGORY_OPENABLE);
    photoPickerIntent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
    startActivityForResult(Intent.createChooser(photoPickerIntent, "Image File Picker"), 1000);

从我的应用程序中的sdcard中选择图像.

to pick image from sdcard within my application.

这很好,根据我的要求,我需要自行关闭该ACTION_PICK selectrActivity,就像当我们触摸将要关闭的对话框之外...

this is working fine, according to my requirement i need to close that ACTION_PICK chooserActivity myself, like when we touch outside the dialog that will closed fine...

但是如何以编程方式关闭这种类型的对话框?

but how can we close this type of dialog programmatically?

推荐答案

您不能.

该选择器实际上是一个单独的活动,由意图启动(当用户选择某些内容时,它将通过意图启动另一个活动).

That chooser is actually a separate activity, launched by intent (which will then launch another activity via intent when the user selects something).

您无法控制该选择器,它实际上不在您的应用程序中.

You don't control that chooser, its not actually in your app.

这篇关于如何以编程方式关闭默认库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆