Skip to content Skip to sidebar Skip to footer

App Crashes When Button Is Hit Although No Errors Shown

I'm trying to build an app with four different activities. On my start page, there are 4 buttons. When you click on a button you should be directed to the correspondent activity.

Solution 1:

You are missing the activities from your manifest. When you create an activity it must be added here as well.

I recommend reading the Android Application Fundamentals.

<activityandroid:name=".MainActivity"android:label="@string/app_name"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity><activityandroid:name=".Allgemein"android:launchMode="singleTop"/>

Also, In the example you provided for your activity, you are not overriding the onCreate method. Make sure all your Activities have this change.

publicclassAllgemeinextendsAppCompatActivity {

    @Override//You are missing this.protectedvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_allgemein);
    }
}

Post a Comment for "App Crashes When Button Is Hit Although No Errors Shown"