2016-09-13 4 views

Antwort

5

Sie können SplashActivity Ihr Bild anzeigen, verwenden Sie Hander.postDelayed(), um diesen Bildschirm 15s vor StartActivity auf dem Hauptbildschirm zu verzögern.

Hier ist Beispiel:

public class Splash extends Activity { 

    /** Duration of wait **/ 
    private final int SPLASH_DISPLAY_LENGTH = 15000; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle icicle) { 
     super.onCreate(icicle); 
     setContentView(R.layout.splashscreen); 

     /* New Handler to start the Menu-Activity 
     * and close this Splash-Screen after some seconds.*/ 

     //Load data 

     new Handler().postDelayed(new Runnable(){ 
      @Override 
      public void run() { 
       /* Create an Intent that will start the Menu-Activity. */ 
       Intent mainIntent = new Intent(Splash.this,MainActivity.class); 
       Splash.this.startActivity(mainIntent); 
       Splash.this.finish(); 
      } 
     }, SPLASH_DISPLAY_LENGTH); 
    } 
} 
+0

Und wie das meine Anwendung auf dem ersten Start zu tun? –

+0

Splash ist eine Aktivität. Sie müssen es auf MAIN ein AndroidManifest setzen – phongvan

+0

Ihr Code ist mir nicht geholfen, wenn ich MainActivity starten mit Absicht, –

Verwandte Themen