I want to know about best practice for this SplashScreen
class:
public class SplashScreen extends Activity {
// time out to splash screen
private static int SPLASH_TIME_OUT = 2000;
private Runnable mjumpRunnable;
private Handler mHandler;
//image view to validae logo
ImageView validatelogo;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
validatelogo = (ImageView) findViewById(R.id.imgvalidatelogo);
validatelogo.setVisibility(View.VISIBLE);
final Animation fadeouteffect = AnimationUtils.loadAnimation(this , R.anim.fadein);
validatelogo.setAnimation(fadeouteffect);
mjumpRunnable = new Runnable() {
@Override
public void run() {
jump();
}
};
mHandler = new Handler();
mHandler.postDelayed(mjumpRunnable , SPLASH_TIME_OUT);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
jump();
}
return super.onTouchEvent(event);
}
void jump(){
if(isFinishing())
return;
startActivity(new Intent(this , LoginActivity.class));
finish();
}
}