My app was running fine on all devices but after adding a splash screen, it crashes on a real device (the splash screen loads fine and then crashes the app) whereas on the virtual device nothing goes wrong. I assume something must be wrong in my splash screen code.
public class Launcher extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launcher);
final ImageView iv1 = (ImageView) findViewById(R.id.launcher_logo);
final ImageView iv2 = (ImageView) findViewById(R.id.launcher_compass);
final ImageView iv3 = (ImageView) findViewById(R.id.launcher_slogan);
final Animation an1 = AnimationUtils.loadAnimation(getBaseContext(),R.anim.rotate);
final Animation an2 = AnimationUtils.loadAnimation(getBaseContext(),R.anim.abc_fade_out);
final Animation an3 = AnimationUtils.loadAnimation(getBaseContext(),R.anim.abc_fade_in);
iv1.startAnimation(an1);
an1.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
iv2.startAnimation(an2);
iv3.startAnimation(an3);
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
an3.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Intent i = new Intent(getBaseContext(), MainActivity.class);
startActivity(i);
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
}
thanks