Reputation: 54949
I am trying to create a Option menu where there is a button to click register. on clicking that i want to go to the RegisterActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.register:
Intent i = new Intent(this, RegisterActivity.class);
startActivity(i);
return true;
case R.id.exit:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
http://variable3.com/files/screenshots/2010-12-26_0034.png
Upvotes: 0
Views: 440
Reputation: 48559
Did you add RegisterActivity to your manifest? It looks like your stacktrace is cut off. I would view your logcat in a terminal instead of in eclipse.
Upvotes: 1
Reputation: 22332
Did you remember to register the activity in your android manifest xml file? (That happens to me all the time). If you read the rest of the text on the line that says ActivityNotFoundException, it would likely ask if you forgot to register it.
Just add this text to your AndroidManifest.xml file in the root of your project:
<activity
android:name=.[sub_package].RegisterActivity
/>
Replacing [sub_package] with whatever package (relative to the lowest level package difference) you had.
So if you had net.x.y.ActivityA and net.x.z.RegisterActivity you would do:
<activity
android:name=.z.RegisterActivity
/>
Upvotes: 2