Skip to content Skip to sidebar Skip to footer

Rotating Image On Button Click

I had created a small app such that the image which is displaying should rotate when I click the button. I have written the following code: import android.app.Activity; import andr

Solution 1:

Lemme guess, you have Button in the layout main.xml, having this attribute android:onClick="Rotate", in which the method defined in the ImageActivity, don't you?

If it is true, rewrite the definition of Rotate() like this: public void Rotate(View v). It should be working fine.

Additionally, you can just use:

img.setImageBitmap(rotatedBMP);

instead of wasting more memory on that BitmapDrawable


Post a Comment for "Rotating Image On Button Click"