我正在将活动组用于选项卡组。
选项卡组 Activity 中的一个子 Activity 包含一个 Contextmenu。但是当我单击菜单项时,在所选上下文菜单项下编写的代码没有运行。
the code which i was written in tabgroup Activity is given below
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
return getLocalActivityManager().getCurrentActivity().onContextItemSelected(item);
}
下面给出了我在 child Achtivity 中编写的代码
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
if(v.getId()==R.id.appointment_listview1)
{
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)menuInfo;
appointmnt_row item = (appointmnt_row)appListView.getItemAtPosition(info.position);
menu.setHeaderTitle(dateString);
menu.add(0, item.getId(), 0, "Delete");
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if(item.getTitle()=="Delete")
{Log.e("delete",""+item1.getId());
} return true;}
请帮助我