Q:

Extremely basic: Switching between Activities (Android)

Hey, I realize there are tutorials on this topic, and even previous questions posed.  However, I've read several tutorials and some answers and I am still having trouble. Clearly, I must not be the brightest crayon in the box.
My program crashes when I try to switch between activities with the following code: 
    final Button switchButton = (Button) findViewById(R.id.change_mode);
    switchButton.setOnClickListener(new View.OnClickListener()
    {
        public void onClick(View v)
        {
            Intent runOptionSelect = new Intent(TheDecider.this, OptionSelect.class);
            startActivity(runOptionSelect);
            return;
        }
    });

I think this code is fine so it must be an issue with the manifest.xml right?  I don't understand when to use which activity constant.  If my purpose is simply to switch to a different layout and class, what should I choose?  
Also, are MAIN and LAUNCHER only to be used on the initial activity to be run?  
So sorry for asking such a basic question but I've spent far too much time researching this to no avail.  Thank you.

A:

Please check below code in your manifest.xml file

<activity android:name=".TheDecider"
              android:label="@string/app_name"
              >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
 <activity android:name=".OptionSelect"
              android:label="@string/app_name"
              >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

A:

In the intent, the first parameter is the current context (you can do 
TheDecider.this

or
getApplicationContext() 

there) and the second one is the class from the activity you are trying to reach.
You are doing that right. And in your manifest you should add
<activity android:name=".OptionSelect"
    android:label="@string/app_name" />

You have to add EVERY Activity in your Manifest, otherwise it will crash. Without knowing your logcat's content, that's all i can say.

