Clickable moving buttons in android -


i'm trying create app in android spawn button @ top of screen random x-possition, have move downwards @ constant pace , when click disappear, i'm confident in abilities of myself 1 problem can't seem work around want able click button time while moving, i've found how change possition of button still fixed while want follow visual button. not sure if i'm saying makes sense if so, if me out appreciated! in advance

public void animate() {     starbutton.startanimation(anim);     long start = system.currenttimemillis();     boolean bool = true;     int = 0;     while(bool) {         long cur = system.currenttimemillis();         if(cur - start >= 50) {             float postogo = starbutton.gety() + 20;             starbutton.sety(postogo);             i++;             start = system.currenttimemillis();             if(i > 40) {                 bool = false;             }         }     } } 

don't use old animation api, use new 1 objectanimators , stuff. check out tutorial : http://www.vogella.com/tutorials/androidanimation/article.html

edit: clarification...the old api didn't move anything, drawing image of view @ different position, view never changed position, new 1 changes position , other properties.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -