问题
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