-2
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle presses on the action bar items
    switch (item.getItemId()) {
        case R.id.action_settings:

(What i must i write here that app will open another activity?)

divjad---
  • 15
  • 7

2 Answers2

0
switch (item.getItemId()){
   case R.id.action_settings:
       Intent i = new Intent(this, AnotherActivity.class);
       startActivity(i);
       break;
}
Orhan Obut
  • 8,756
  • 5
  • 32
  • 42
0

Write this to open a new activity-

@Override
public boolean onOptionsItemSelected(MenuItem item) 
{
    // Handle presses on the action bar items
    switch (item.getItemId()) 
    {
        case R.id.action_settings:
Intent intent = new Intent(YourCurrentActivity.this, NextActivity.class);
startActivity(intent);
amit singh
  • 1,407
  • 2
  • 16
  • 25