I am using the following code to choose a picture from gallery.
Intent intent_gallery = new Intent();
intent_gallery.setType("image/*");
intent_gallery.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent_gallery, 1);
However I don't need it to view other applications for choosing pictures. I want it to directely open default gallery instead of showing 开发者_开发知识库me other applications for choosing pictures.
Intent intent_gallery = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent_gallery, 1);
got it..worked for me!!
This is not possible, it's the users choice with which application he wants to accomplish the task of picking a picture from the gallery. He can check the "Use this as my default application for this task" box, but thats still a user action.
Your only chance would be to hardcode the gallery package name in the intent - which is bad because there are quite a few different gallery apps out there. If the one with the hardcoded package is not present, your app won't work.
精彩评论