Skip to content Skip to sidebar Skip to footer

Why Has My Android App Stopped?

I make my application in Android Studio. I run this application but the Android app stopped. I make a app with an animation. Here is my source code: AndroidManifest:

Solution 1:

Button button = (Button) findViewById(R.id.button);

You need to put that line in your onCreate method.

Basically, at the field level, you can have Button button; and then in onCreate you would initialize the variable thusly: button = (Button) findViewById(R.id.button);. You can't call findViewById() before the view has been inflated.

As a side note, a stacktrace may look intimidating at first, but the easiest way to deal with it, is to search for your package name, in this case "com.geven.animation". The first entry in the stack trace that includes that package name is usually the offending line. at com.geven.animation.MainActivity.<init>(MainActivity.java:14) so line 14 of your MainActivity class.

Post a Comment for "Why Has My Android App Stopped?"