Unable to select particular images using ACTION_PICK intent

前端 未结 2 1082
小鲜肉
小鲜肉 2020-12-06 03:29

I\'m using an intent like this:

Intent intent = new Intent(Intent.ACTION_PICK,
        android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);


        
相关标签:
2条回答
  • 2020-12-06 04:16

    hops this will helps you ....

    ACTIVITYRESULT_CHOOSEPICTURE is the int you use when calling startActivity(intent, requestCode);

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if(requestCode == ACTIVITYRESULT_CHOOSEPICTURE) {
        BitmapFactory.Options options = new BitmapFactory.Options();
        final InputStream ist = ontext.getContentResolver().openInputStream(intent.getData());
        final Bitmap bitmap = BitmapFactory.decodeStream(ist, null, options);
        ist.close();
      }
    }
    

    if above code doesn't work than just refer this link... it will surly shows the way

    http://dimitar.me/how-to-get-picasa-images-using-the-image-picker-on-android-devices-running-any-os-version/

    0 讨论(0)
  • 2020-12-06 04:20

    try this:

    String selectedImagePath = imageUri.getEncodedPath();
    

    it works for me using gallery image picker

    maybe this:

    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), data.getData());
    
    0 讨论(0)
提交回复
热议问题