Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. @Override
  2.     protected void onActivityResult(int requestCode, final int resultCode, Intent data) {
  3.         Log.d(getClass().getName(), "onActivityResult");
  4.  
  5.         if (resultCode == Activity.RESULT_OK) {
  6.             Image image = ImagePicker.getFirstImageOrNull(data);
  7.  
  8.             if (image != null) {
  9.                 String path = image.getPath();
  10.                 Log.d(getClass().getName(), "ImagePath: " + path);
  11.                 Bitmap bitmap = BitmapFactory.decodeFile(path);
  12.                 Bitmap scaled = scaleDown(path, bitmap, 800, false);
  13.  
  14.                 if (requestCode == 1) {
  15.                     mPhotoPath = path;
  16.                     photoImageView.setImageBitmap(scaled);
  17.                     photoImageView.setVisibility(View.VISIBLE);
  18.                     takePhotoButton.setVisibility(View.GONE);
  19.                     removePhotoButton.setVisibility(View.VISIBLE);
  20.                 }
  21.             } else {
  22.                 Log.d(getClass().getName(), "Image null");
  23.             }
  24.         }
  25.  
  26.         super.onActivityResult(requestCode, resultCode, data);
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement