android - Rotating an image, angle by angle, and waiting for refresh -


i'm trying rotate image full rotation, small angle-increment @ time.

each proceeding rotation should begin after previous rotation has been displayed.

how fast rotation happens means nothing me - long each rotation displayed it's fine me. means can practically considered "too fast".

i've tried few different approaches this. have working solution below (something along these lines, @ least - i've been playing code, might not compilable).

handler handler instance , of code below located in body of activity class i'm starting from. rotationincrement 0.36, we're "rotating" image 1000 times posting new runnable ui-thread each time previous rotation finished.

public void start(view view) {     mainactivity.rotation=0;     imageview.setscaletype(scaletype.matrix);     handler.post(new rotationrunnable());        }  public class rotationrunnable implements runnable {         @override         public void run() {             mainactivity.rotation+=rotationincrement;             //log.d("rotating", string.valueof(rotation));             matrix matrix = new matrix(imageview.getimagematrix());             matrix.setrotate(rotation);             imageview.setimagematrix(matrix);             imageview.invalidate();              if (mainactivity.rotation<360) {                 handler.post(new rotationrunnable());             } else {                 log.d("elapsed", string.valueof((system.nanotime()-starttime)));             }         } } 

the code above gives me pretty smooth "animation". 1000 rotations, takes 16s on samsung galaxy nexus finish.

my question this;

is there better way - if goal have rotation happen fast possible - , maintaining each rotation displayed in order?

this not going implemented product or - more artificial test, i'm not looking more "convenient" ways of animating rotation.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -