Reputation: 1259
I'm developing a basic simple android application & want the default settings to lead to other activity,
I know this is kinda silly and out topic but I really don't understand how can I default action bar's setting option make lead to my other activity.
The bottom settings option pops up when clicked menu or in some phones on action bar.
Upvotes: 0
Views: 127
Reputation: 4856
You will have to create and start a new activity on the click event of the menu option. In your code, you will have something like this
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.my_menu, menu);
return true;
}
The above code will inflate the menu XML file. Now, to take some action when an menu option is clicked, you use this code:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.settings:
//start your activity here
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Upvotes: 1