android flyin imageview after a certain time - stack overflow.pdf
TRANSCRIPT
![Page 1: android flyin imageView after a certain time - Stack Overflow.pdf](https://reader030.vdocuments.net/reader030/viewer/2022020403/577c77f71a28abe0548e2e04/html5/thumbnails/1.jpg)
Stack Overflow sign up log in
Questions Tags Users Badges Unanswered Ask
1 android flyin imageView after a certain timeandroid animation android-imageview postdelayed
The purpose I aming for is, that 2 seconds after my activity was started an ImageView (with an image) should flyIn to the view. But with the followingcode nothing happens.
Am I on the right way or can I solve this completely different? What do I have to change that this works?
Here is how my code looks:
The animation I use is from here : Fly In Animation for a GridView But slightly changed:
} };
_flyInTruckHandler.postDelayed(new Runnable() { public void run() { new flyInTruck(); } }, 2000); }
class flyInTruck extends TimerTask {
@Override public void run() { Animation anim = AnimationUtils.loadAnimation( getApplicationContext(), R.anim.flyin); findViewById(R.id.main_garbageTruck).setAnimation(anim); _flyInTruckHandler.sendEmptyMessage(0); anim.start(); } } }
Read this post in our app!
![Page 2: android flyin imageView after a certain time - Stack Overflow.pdf](https://reader030.vdocuments.net/reader030/viewer/2022020403/577c77f71a28abe0548e2e04/html5/thumbnails/2.jpg)
1 Answer Order By Votes
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="true" > <scale android:duration="2500" android:fillAfter="false" android:fromXScale="0.0" android:fromYScale="0.0" android:interpolator="@android:anim/decelerate_interpolator" android:pivotX="50%" android:pivotY="50%" android:toXScale="1.0" android:toYScale="1.0" /> </set>
share improve this question
AskedJul 1 '12 at 5:31
Bruno Bieri 1,998 ● 4 ● 24 ● 41
0SOLUTION
Ok, I got it (so simple and I didn't thought about that before). I do not need that extra class "flyInTruck". I just can write it like this:
_flyInTruckHandler.postDelayed(new Runnable() { public void run() { Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.flyin); findViewById(R.id.main_garbageTruck).setAnimation(anim); _flyInTruckHandler.sendEmptyMessage(0); anim.start(); } }, 2000);
share improve this answer
AnsweredJul 1 '12 at 5:38
Bruno Bieri 1,998 ● 4 ● 24 ● 41
![Page 3: android flyin imageView after a certain time - Stack Overflow.pdf](https://reader030.vdocuments.net/reader030/viewer/2022020403/577c77f71a28abe0548e2e04/html5/thumbnails/3.jpg)
Post Your Answer
Your Answer
log in
or
Name
By posting your answer, you agree to the privacy policy and terms of service.
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc
EditedJul 11 '12 at 5:36
![Page 4: android flyin imageView after a certain time - Stack Overflow.pdf](https://reader030.vdocuments.net/reader030/viewer/2022020403/577c77f71a28abe0548e2e04/html5/thumbnails/4.jpg)