0

in XML, I have image button without the src

<ImageButton android:id="@+id/imagebutton1" android:layout_width="120px" android:layout_height="90px" android:scaleType="centerInside"/>

And I somewhere along.. I set either the URI or thumbnail using

((ImageButton) findViewById(R.id.imagebutton3)).setImageURI(uri);
((ImageButton) findViewById(R.id.imagebutton1)).setImageBitmap(bm);

Q1 Fixed!

Q2: When screen rotate, all my Image Buttons set with .setImageURI and .setImageBitmap is cleared. How do I prevent that?

Cle
  • 100
  • 6

1 Answers1

0

A1: Try this ((ImageButton) findViewById(R.id.imagebutton3)).setImageURI(0);

A2: Saving Android Activity state using Save Instance State

Community
  • 1
  • 1
Nikhil
  • 16,194
  • 20
  • 64
  • 81
  • About the saving application state, I can savedInstanceState.putString but I don't know how to put URI and Bitmaps. – Cle May 19 '11 at 06:23