0

how can I link my setting buttons in the action bar with a another activity.

@Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch(item.getItemId()){
        case R.id.about:
            about(); // shows a dialogbox
            break;
        case R.id.settings:
            // I want to link this with my setting screen
            break;
        }
        return super.onOptionsItemSelected(item);
    }

I linked up my about action bar button with a dialog box but for my settings, I want it to go to another activity. How can I do this? The activity I want to link to is called settings.java

Android
  • 171
  • 1
  • 4
  • 16

1 Answers1

0

How about this?

@Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch(item.getItemId()){
        case R.id.about:
            about(); // shows a dialogbox
            break;
        case R.id.settings:
            startActivity(this, settings.class);
            // This doesn't work?
            break;
        }
        return super.onOptionsItemSelected(item);
    }
Antrromet
  • 15,294
  • 10
  • 60
  • 75