Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:46:32+00:00 2026-06-06T17:46:32+00:00

The purpose I aming for is, that 2 seconds after my activity was started

  • 0

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 following code 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:

public class Main extends Activity {
    private ImageView _truck;
    private Handler _flyInTruckHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        _truck = (ImageView) findViewById(R.id.main_garbageTruck);
        _truck.setVisibility(View.INVISIBLE);

        _flyInTruckHandler = new Handler() {
            public void handleMessage(Message msg) {
                _truck.setVisibility(View.VISIBLE);
            }
        };

        _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();
        }
    }
}

The animation I use is from here : Fly In Animation for a GridView
But slightly changed:

<?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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:46:34+00:00Added an answer on June 6, 2026 at 5:46 pm

    SOLUTION

    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);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The purpose of this code is to pull upgrade.zip from a central server, extract
The purpose is to use C++ in a useful way. I have just started
I have two functions declared as following, using extern C aming to avoid name
After reading around, I've realized that SQL ( MySQL in my case ) does
First off, I'm aware that there are many questions related to this, but none
I am new to Haskell,I should write a function that takes a function among
Purpose: I plan to Create a XML file with XmlTextWriter and Modify/Update some Existing
Purpose: To make sure some elements couldn't be modified, I disabled some elements once
Purpose: to receive UDP unicast packets sent to a single port in two different
[purpose] This simple command sequence runs expected in the Windows' CMD shell: dir &

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.