2

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

jayeshsolanki93
  • 2,096
  • 1
  • 20
  • 37
Emmanuel Conradie
  • 345
  • 1
  • 5
  • 20

1 Answers1

0

How big are those images in your imageviews? I have had similar issues where the images aren't too big (IMO) but they end up crashing the app. Check out this answer:

https://stackoverflow.com/a/8205044/742197

it has helped me in the past. Unfortunately, without the logcat it is hard to know what the real issue is but it is worth a try. If that doesn't work, try removing everything, and adding things back one at a time to find out what the issue is.

Community
  • 1
  • 1
alex_milhouse
  • 891
  • 1
  • 13
  • 31