SPLASH SCREEN

350 views.

How to implement splash screen ?

Add Comment
1 Answer(s)
195 views.

package com.sravani;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
public class Splash extends AppCompatActivity {
 private static int splashTimeOut = 800;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
/*
 * Showing splashactivity screen with a timer. This will be useful when you
 * want to show the logo / name.
 */
@Override
 public void run() {
// This method will be executed once the timer is over. here you specify your target class
 Intent splash = new Intent(Splash.this,Main.class);
 startActivity(splash);
// close this activity
 Splash.this.finish();
 overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
 }
 }, splashTimeOut);
}
 }
Answered on September 1, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.