如何在弹出菜单项单击上开始新的意图。以下是我尝试过的代码:
public class Profile extends Fragment {
public Profile() { }
View vi;
public static final String ARG_SECTION_NUMBER = "section_number";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
vi = inflater.inflate(R.layout.profile, container, false);
TextView iv = (TextView) vi.findViewById(R.id.btnprofile_settings);
iv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
PopupMenu homepopup = new PopupMenu(getActivity(), v);
MenuInflater inflater = homepopup.getMenuInflater();
inflater.inflate(R.menu.account_settings, homepopup.getMenu());
homepopup.show();
}
});
return vi;
}
}
有任何想法吗?
谢谢,