1

I have 2 activities and both have an Imageview, I want to pass Image taken from camera/gallery on activty one to activity 2. I don't want to pass Image itself I want to pass URI(and than set the uri to bitmap of activity 2 and Imageview) of the Image so it would consume less memory but I don't know the Way. Please Help Me. PS: If image is not taken/not selected from Gallery the ImageView of Activity 2 should show "Nothing Selected"

Siddharth
  • 23
  • 1
  • 4

1 Answers1

3

Simply pass your image path as String in intent :

intent.putExtra("imagePath", imageFilePath); 

Get image path from intent and load using BitmapFactory :

String imagePath = getIntent().getStringExtra("imagePath");
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
imageView.setImageDrawable(bitmap);
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67