Skip to content Skip to sidebar Skip to footer

Acitivity Two Starts Before Main Activity

I can not find any solution for this problem. Here it is. I have two activities: Main Activity and Triangle Activity and I want to see the Main Activity when app starts. Here is my

Solution 1:

if (savedInstanceState == null) {
        // on first time display view for first nav itemselectItem(0);
    }

This looks odd to me. I would guess that when your Activity first loads, savedInstanceState is null so you are automatically selecting item one in your nav menu, which is the TriangleActivity class. Remove the above section of code and see what happens.

Solution 2:

You are calling

if (savedInstanceState == null) {
    // on first time display view for first nav itemselectItem(0);
}

inside onCreate() this will call TriangleActivity immediately before onCreate() is finished. Perhaps you should move it to some onClick method of a button or layout so that you can control the starting of activity.

Post a Comment for "Acitivity Two Starts Before Main Activity"