Hello All,
On create I have the following code

ListView lv=(ListView)findViewById(R.id.lvItems);
registerForContextMenu(lv);

adapter= new ShoppingListAdapter(this, R.layout.shippinglistitem, items);
lv.setAdapter(adapter);

I Override the onCreateContexxtMenu (outside of onCreate ofcourse)
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo
menuInfo)
 {
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(1,MENU_LIST_EDIT,0,"Edit");
 menu.add(1,MENU_LIST_DELETE,0,"Delete");
}


public boolean onContextItemSelected(MenuItem item) {
//  AdapterContextMenuInfo info = (AdapterContextMenuInfo)
item.getMenuInfo();
  switch (item.getItemId()) {
  case MENU_LIST_EDIT:
  {
  return true;
  }

  case MENU_LIST_DELETE:
  {
    return true;
  }
  default:
    return super.onContextItemSelected(item);
  }
}


For some reason when I try hold the mouse over the items or if I use the D
pad and go down to an item and hold it nothing comes up. The layout of list
is below thanks for any suggestions

The following List View
<ListView
android:id="@+id/lvItems"
android:layout_width="fill_parent"
 android:layout_height="wrap_content"
android:choiceMode="singleChoice"
 android:focusable="true"
android:clickable="true"
 android:longClickable="true"
>
</ListView>

Which uses displays the following Items

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<CheckBox
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/rowItemBought"
  android:paddingRight="10px"
  />
  <TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:id="@+id/rowItemName"
  android:paddingRight="10px"
  />
</LinearLayout>


Sincerely
Jose C Gomez

http://www.josecgomez.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to