By any chance does your list item adapter have a control in it that can be
focused? If so that is your problem (checkbox, edit text, button) if any of
these are in your listItem you have to turn their focusability off in order
for the click and hold to register with the list.

Sincerely
Jose C Gomez

http://www.josecgomez.com


On Sun, Apr 25, 2010 at 7:44 AM, Paweł Zięba <pawzi...@gmail.com> wrote:

> ListView is subclass of AdapterView.
>
> In your case try this code, paste it into onCreate method
>
> layout_list.setOnItemClickListener(new OnItemClickListener() {
>         @Override
>        public void onItemClick(AdapterView<?> parent, View v, int
> position, long id) {
>                Toast.makeText(MainView.this, "Id: " + id + ", pos: "
> + position, Toast.LENGTH_SHORT).show();
>        }
> });
>
> layout_list.setOnItemLongClickListener(new OnItemClickListener() {
>         @Override
>        public void onItemClick(AdapterView<?> parent, View v, int
> position, long id) {
>                Toast.makeText(MainView.this, "Id: " + id + ", pos: "
> + position, Toast.LENGTH_SHORT).show();
>        }
> });
>
> where MainView is your activity
>
>
>
> On 25 Kwi, 13:49, Reiny Song <reiny.s...@gmail.com> wrote:
> > thank you~
> >
> > But I do not know how to try your recommend.
> >
> > the sample code are following:
> >
> > ListView   layout_list =
> (ListView)inflate.inflate(R.layout.main_list,null);
> > MyAdapter adapter  = new MyAdapter(.........)
> > layout_list.setAdapter(listAdapter);
> >
> > I can not get the AdapterView from my listview,
> >
> > could you please give me some direction.
> >
> > 2010/4/25 Paweł Zięba <pawzi...@gmail.com>
> >
> >
> >
> >
> >
> > > Try methods from AdapterView instead of View:
> >
> > > final AdapterView.OnItemClickListener    getOnItemClickListener()
> > > final AdapterView.OnItemLongClickListener
> > > getOnItemLongClickListener()
> > > final AdapterView.OnItemSelectedListener
> > > getOnItemSelectedListener()
> >
> > > On 25 Kwi, 13:08, Reiny Song <reiny.s...@gmail.com> wrote:
> > > > hello,
> >
> > > > I try it, but there is no any response in listview.
> >
> > > > When I clicked the item in listview by mouse,
> >
> > > > the OnTouchListener, OnItemSelectedListener and OnTouchListener  of
> the
> > > > listview do not response to me.
> >
> > > > But when I selected the item in listview by scroll wheel,
> >
> > > > the OnItemSelectedListener showed the item was selected.
> >
> > > > It confuses me a lots@@
> >
> > > > 2010/4/25 murali raju <manutd...@gmail.com>
> >
> > > > > did u try onItemClickListener
> >
> > > > > On Sun, Apr 25, 2010 at 10:19 AM, Reiny Song <reiny.s...@gmail.com
> >
> > > wrote:
> >
> > > > >> I should provide more detail about what I did,
> >
> > > > >> my listview contains the MyAdapter( extends simpleAdapter )
> >
> > > > >> I tried something (the followings are), but nothing helped me.
> >
> > > > >> 1. I set the listview setClickable,
> > > > >> setFocusableInTouchMode, setLongClickable  = true
> >
> > > > >> 2. set the convertView in getView at MyAdapter
> >
> > > > >>     setClickable, setFocusable ,setFocusableInTouchMode and
> > > > >> setLongClickable = true
> >
> > > > >> But, when I "click" the item in listview, the item is still not
> > > selected.
> > > > >> (but... the item can be selected by scroll wheel...)
> >
> > > > >> 2010/4/25 Reiny <reiny.s...@gmail.com>
> >
> > > > >> Dear all,
> >
> > > > >>> I have a problem about the the listview.
> >
> > > > >>> My activity runs in simulator, and I use mouse to control it.
> >
> > > > >>> When I select the item in listview by turning scroll wheel, the
> > > > >>> background of item becomes orange.
> >
> > > > >>> But, when I "click" the item in listview, the item does not
> response
> > > > >>> to my action.
> >
> > > > >>> anyone knows the reason? thank you~
> >
> > > > >>  --
> > > > >> 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com><android-developers%2Bunsubs
> > > cr...@googlegroups.com>
> > > > >> For more options, visit this group at
> > > > >>http://groups.google.com/group/android-developers?hl=en
> >
> > > > >  --
> > > > > 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com><android-developers%2Bunsubs
> > > cr...@googlegroups.com>
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > --
> > > > 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com>
> > > > For more options, visit this group athttp://
> > > groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > 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<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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