Skip to content

PictureSelector 2.0 Result Callback

Luck edited this page Jan 9, 2022 · 1 revision
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        switch (requestCode) {
            case PictureConfig.CHOOSE_REQUEST:
                // Selection Result Callback
                selectList = PictureSelector.obtainMultipleResult(data);
                // LocalMedia Returns Five Paths
                // 1.media.getPath(); 
                // 2.media.getCutPath();
                // 3.media.getCompressPath();
                // 4.media.getOriginalPath());
                // 5.media.getAndroidQToPath();
                for (LocalMedia media : selectList) {
                    Log.i(TAG, "CompressPath::" + media.getCompressPath());
                    Log.i(TAG, "Original::" + media.getPath());
                    Log.i(TAG, "CropPath::" + media.getCutPath());
                    Log.i(TAG, "isOriginal::" + media.isOriginal());
                    Log.i(TAG, "OriginalPath::" + media.getOriginalPath());
                    Log.i(TAG, "Android Q To Path::" + media.getAndroidQToPath());               
                }
                break;
        }
    }
}

.forResult(new OnResultCallbackListener() {
      @Override
      public void onResult(List<LocalMedia> result) {
             // Selection Result Callback
             selectList = PictureSelector.obtainMultipleResult(data);
             // LocalMedia Returns Five Paths
             // 1.media.getPath(); 
             // 2.media.getCutPath();
             // 3.media.getCompressPath();
             // 4.media.getOriginalPath());
             // 5.media.getAndroidQToPath();
             for (LocalMedia media : selectList) {
                Log.i(TAG, "CompressPath::" + media.getCompressPath());
                Log.i(TAG, "Original::" + media.getPath());
                Log.i(TAG, "CropPath::" + media.getCutPath());
                Log.i(TAG, "isOriginal::" + media.isOriginal());
                Log.i(TAG, "OriginalPath::" + media.getOriginalPath());
                Log.i(TAG, "Android Q To Path::" + media.getAndroidQToPath());               
           }
     }

      @Override
      public void onCancel() {
         Log.i(TAG, "PictureSelector Cancel");
     }

  });