Skip to content Skip to sidebar Skip to footer

Imageview - Image Lost On Change In Orientation

I have an application where I take a picture and set it as the image on image button. On change in orientation, the image vanishes. Please help. I click a picture and set it as the

Solution 1:

I was missing onResume()

protectedvoidonResume()
{
    super.onResume();
    if (scaledBmp != null)
    {
        ImageButtonib= (ImageButton) findViewById(R.id.itemImage);
        if (ib != null)
            ib.setImageBitmap(scaledBmp);
    }
}

With this change, things started working. I am getting the image in landscape as well as portrait mode.

Asthme's comment helped me, thanks.

Post a Comment for "Imageview - Image Lost On Change In Orientation"