如何将操作栏中的设置按钮与另一个活动相关联。
@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);
}
我将关于操作栏按钮与对话框联系起来,但对于我的设置,我希望它转到另一个活动。我怎样才能做到这一点?我想要链接的活动叫做settings.java
答案 0 :(得分:0)
这个怎么样?
@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);
}