Arslan Ali Khan Arslan Ali Khan - 3 years ago 136
Android Question

I want to transfer the image from one activity to another

I have to transfer the image from one activity to another. In first activity the user selects the image out of several images from scroll view and that image has to be displayed in the imageview of next activity. Help required.

Answer Source

In your first Activity

Convert ImageView to Bitmap

    imageView.buildDrawingCache();
    Bitmap bitmap = imageView.getDrawingCache();

    Intent intent = new Intent(this, NewActivity.class);
    intent.putExtra("BitmapImage", bitmap);

In second Activity

     Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");

Then display bitmap in ImageView.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download