How to close default gallery programmatically?

爷,独闯天下 提交于 2020-01-07 04:55:07

问题


I am using this code

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

to pick image from sdcard within my application.

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?


回答1:


You can't.

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.



来源:https://stackoverflow.com/questions/16663241/how-to-close-default-gallery-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!