问题描述
- android中从默认的图片库中选择图片的问题
- 我使用下面的代码从图片库中选择一个图片:
Intent intent_gallery = new Intent();intent_gallery.setType(""image/*"");intent_gallery.setAction(Intent.ACTION_GET_CONTENT);startActivityForResult(intent_gallery 1);
但是我不需要查看其它的程序来选择图片,我想让它直接打开默认的图片库,而不是显示一个另外的程序来让我选择图片。
解决方案
Intent intent_gallery = new Intent(Intent.ACTION_PICK android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);startActivityForResult(intent_gallery 1);
时间: 2024-08-30 17:43:22