views:

87

answers:

1

Hey,

So I have this code in my main activity to start a new one:

public class MainActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        findViewById(R.id.GoButton).setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View v)
            {                   
                Intent myIntent = new Intent(MainActivity.this, NewActivity.class);
                MainActivity.this.startActivity(myIntent);
                //finish();
            }
        });
    }
}

My new activity extends ListActivity and when I call this code by pressing the button it crashes the application. However if I make the MainActivity extend ListActivity then it works great (although I have to replace the button with a List!). Does anyone know why this happens, and how can I make it work using the code above?

Thanks

+1  A: 

Have you added the manifest entry

josnidhin