Created
December 12, 2014 07:41
-
-
Save Krishan14sharma/f28e012ba9498b1d29d4 to your computer and use it in GitHub Desktop.
Splash Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dnn.zapbuild.sports.controller.activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.support.v7.app.ActionBarActivity; | |
import com.dnn.zapbuild.sports.R; | |
/**@author zapbuild | |
* This is the launcher activity.Shows an image for SPLASH_TIME and then kills itself after passing | |
* the control. | |
*/ | |
public class SplashActivity extends ActionBarActivity { | |
public static final int SPLASH_TIME=2*1000; | |
Handler mhandler; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_splash); | |
mhandler=new Handler(); | |
mhandler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
Intent in = new Intent(SplashActivity.this, MainActivity.class); | |
startActivity(in); | |
finish(); | |
} | |
}, SPLASH_TIME); | |
} | |
@Override | |
public void onBackPressed() { | |
// There is no back pressing allowed on this activity. | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
if(mhandler!=null) | |
{ | |
mhandler.removeCallbacksAndMessages(null); | |
mhandler=null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment