In android, we can rotate the image using matrix post rotate. Example for Android Image Rotate :-
01
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
02
<
LinearLayout
android:id
=
"@+id/LinearLayout01"
03
android:layout_width
=
"fill_parent"
04
android:layout_height
=
"fill_parent"
06
android:background
=
"#ffffff"
07
android:gravity
=
"center"
>
08
<
ImageView
android:id
=
"@+id/ImageView01"
09
android:layout_width
=
"wrap_content"
10
android:layout_height
=
"wrap_content"
11
android:src
=
"@drawable/refresh"
/>
01
public
class
ExampleApp
extends
Activity
03
private
ImageView img;
06
protected
void
onCreate(Bundle savedInstanceState) {
07
super
.onCreate(savedInstanceState);
08
setContentView(R.layout.main);
10
img=(ImageView)findViewById(R.id.ImageView01);
11
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.refresh);
13
int
w = bmp.getWidth();
14
int
h = bmp.getHeight();
16
Matrix mtx =
new
Matrix();
19
Bitmap rotatedBMP = Bitmap.createBitmap(bmp,
0
,
0
, w, h, mtx,
true
);
20
BitmapDrawable bmd =
new
BitmapDrawable(rotatedBMP);
22
img.setImageDrawable(bmd);
The output will looks like (1st image is Before rotating the image, 2nd image is After rotating the image)