0

I would like to display an image at the opening of my application Android (Java), is like a toast in full screen only.

That is, when you open the application and an image appears and disappears after you start the program.

What better way to do this?

GDawson
  • 337
  • 1
  • 7
  • 19

4 Answers4

2

You mean Splash screen? If so, here is your answer: Splash Screen

Community
  • 1
  • 1
April Smith
  • 1,810
  • 2
  • 28
  • 52
1

It's called a SplashScreen the links are here http://www.anddev.org/simple_splash_screen-t811.html and here http://blog.iangclifton.com/2011/01/01/android-splash-screens-done-right/


Cheers

Sergey Benner
  • 4,421
  • 2
  • 22
  • 29
0

I think you are looking for Splash screen in android.
I found above link really helpful. There are lots of other article available. Just ask Google

Ajinkya
  • 22,324
  • 33
  • 110
  • 161
0

You have to create an Activity with this image on the layout.

Then within this activity, create a Thread that will sleep for X seconds. When the Thread slept enough, start a new activity.

This is an example code :

public class SplashActivity extends Activity {

    public StartThread th;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        th = new StartThread(this);
        th.start(); 
    }
}

class StartThread extends Thread {
    SplashActivity parentActivity;
    public StartThread(SplashActivity splashActivity) {
        this.parentActivity = splashActivity;
    }
    @Override
    public void run() {
        super.run();        
        try {
            this.sleep(3000);       
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        finally {
            Intent menu = new Intent("com.yourpackage.yourapplication.NEXTACTIVITY");
            this.parentActivity.startActivity(menu);
            this.parentActivity.finish();
            this.parentActivity.th = null;
        }
    }
}
turbodoom
  • 235
  • 1
  • 3
  • 14