class MyMenuItemClickListener implements PopupMenu.OnMenuItemClickListener {
public MyMenuItemClickListener() {
}
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_add_favourite:
Toast.makeText(mContext, "Add to favourite", Toast.LENGTH_SHORT).show();
return true;
case R.id.action_play_next:
Toast.makeText(mContext, "Play next", Toast.LENGTH_SHORT).show();
return true;
default:
}
return false;
}
}
这是我的代码请somone建议如何使用intent切换活动而不是显示吐司。
答案 0 :(得分:0)
只需为下一个活动添加意向调用。
Intent intent = new Intent(getApplicationContext(), YourActivity.class);
startActivity(intent);
答案 1 :(得分:0)
尝试这样做:
Intent intent = new Intent(this, IntendedActivity.class); // pass necessary context
startActivity(intent);
检查此链接以了解您可以执行的所有操作: Start Another Activity