There might be something screwy with your layout XML, where there is
something intercepting the touch events.

Here is a sample project showing a ListView that responds to clicks
(in this case, via ListActivity and onListItemClick()) while inside a
tab:

http://github.com/commonsguy/cw-andtutorials/tree/master/06-Tabs/LunchList/

On Thu, Sep 9, 2010 at 2:18 PM, JasonMP <hyperje...@gmail.com> wrote:
> I have a tab activity with three tabs and I want to display a listview
> in each tab.  The list populates correctly, but for some reason I can
> not get the context menu or itemclicklistener to recognize gestures on
> the listviews.  Anyone have any ideas why this might be?   Below is my
> onCreate method:
>
> @Override
>        public void onCreate(Bundle savedInstanceState) {
>                  super.onCreate(savedInstanceState);
>                  setContentView(R.layout.armory_header);
>
>                  TabHost mTabHost = getTabHost();
>
>
> mTabHost.addTab(mTabHost.newTabSpec("1").setIndicator("Weapons").setContent(R.id.page1));
>
> mTabHost.addTab(mTabHost.newTabSpec("2").setIndicator("Armor").setContent(R.id.page2));
>
> mTabHost.addTab(mTabHost.newTabSpec("3").setIndicator("Accessories").setContent(R.id.page3));
>
>
>                  weapons = (ListView) findViewById(R.id.weaponlist);
>                  registerForContextMenu(weapons);
>                  weapons.setOnItemClickListener(new OnItemClickListener(){
>
>                               �...@override
>                                public void onItemClick(AdapterView<?> arg0, 
> View arg1, int arg2,
>                                                long arg3) {
>                                        // TODO Auto-generated method stub
>                                        listId = weapons.getId();
>                                        position = arg2;
>                                        showDialog(DIALOG);
>                                }
>
>                          });
>
>                  armor = (ListView) findViewById(R.id.armorlist);
>                  registerForContextMenu(armor);
>                  armor.setOnItemClickListener(new OnItemClickListener(){
>
>                               �...@override
>                                public void onItemClick(AdapterView<?> arg0, 
> View arg1, int arg2,
>                                                long arg3) {
>                                        // TODO Auto-generated method stub
>                                        listId = armor.getId();
>                                        position = arg2;
>                                        showDialog(DIALOG);
>                                }
>
>                          });
>
>        }
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://skillsmatter.com/go/os-mobile-server

-- 
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