@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.actionbar_menu_friendstimelinefragment, menu); name = menu.findItem(R.id.group_name); if (selectedId.equals("0")) { name.setTitle(userBean.getScreen_name()); } if (selectedId.equals("1")) { name.setTitle(getString(R.string.bilateral)); } else { for (GroupBean b : GlobalContext.getInstance().getGroup().getLists()) { if (b.getIdstr().equals(selectedId)) { name.setTitle(b.getName()); return; } } } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.write_weibo: Intent intent = new Intent(getActivity(), WriteWeiboActivity.class); intent.putExtra("token", token); intent.putExtra("account", accountBean); startActivity(intent); break; case R.id.refresh: if (allowRefresh()) pullToRefreshListView.startRefreshNow(); break; case R.id.group_name: if (canSwitchGroup()) { FriendsGroupDialog dialog = new FriendsGroupDialog(GlobalContext.getInstance().getGroup(), selectedId); dialog.setTargetFragment(this, 1); dialog.show(getFragmentManager(), ""); } break; } return super.onOptionsItemSelected(item); }