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.

7
задан BlackVegetable 18 May 2011 в 17:50
поделиться