Android从SD卡中选择图片的三种方法及自定义系统选择框标题的方法
jopen
11年前
方法一:
Intent localIntent = new Intent(); localIntent.setType("image/*"); localIntent.setAction("android.intent.action.GET_CONTENT"); startActivityForResult(localIntent, PHOTO_PICKED_WITH_DATA);效果图:
方法二:
Intent localIntent = new Intent(); localIntent.setType("image/*"); localIntent.setAction("android.intent.action.GET_CONTENT"); Intent localIntent2 = Intent.createChooser(localIntent, "选择图片撒"); startActivityForResult(localIntent2, PHOTO_PICKED_WITH_DATA);
效果图:
方法三:(直接进入图库)
Intent localIntent3 = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(localIntent3, PHOTO_PICKED_WITH_DATA);