I want my splash screen to be shown only on first start. I know that I have to go through shared preferences but how? This is my splash:
public class Splash extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.splash);
//animation
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Animation alpha = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.fade_in);
imageView.startAnimation(alpha);
alpha.setAnimationListener((new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
// TODO Start your activity here.
Intent mainIntent = new Intent(Splash.this, MainActivity.class);
Splash.this.startActivity(mainIntent);
Splash.this.finish();
}
}));
}
}