tags:

views:

24

answers:

1

Hi All,

I have a requirement for an app, in android, which requires 2 images to be populated one above another.

This image has to be rotated, based on the Compass sensors. I am rotating the image,using matrix, and creating the new bitmap, and setting the bitmap on Imageview.

I am repeating the same, for 2 images.But as a result, i am getting a delay, can this be avoided, is there any other way.

If i am using canvas, can i use multiple images, out of which i want only 2 images to be rotated, is it possible??

+1  A: 

I would have done it something like the following:

// Two abritary rotations for the bitmaps
int angle1=45;
int angle2=10;

canvas.save();
canvas.rotate(angle1,xcenter,ycenter);
canvas.drawBitmap(...); // However you are drawing you bitmap
canvas.restore();

canvas.save();
canvas.rotate(angle2,xcenter2,ycenter2);
canvas.drawBitmap(...);
canvas.restore();

// where xcenter and ycenter are the location around which you will rotate
stealthcopter