On Tue, Jul 27, 2010 at 4:13 AM, CG <[email protected]> wrote:
> Thanks for the reply , I have tried to add onClickListener to a
> ListView but it throws exception to ask me to use onItemClickListener
> instead .
Correct.
> I try with onItemClickListener but it does not seems to trigger ... ,
> I am using a custom Adapter.
>
> mListViewSelection.setOnItemClickListener(new
> AdapterView.OnItemClickListener() {
>
> �...@override
> public void onItemClick(AdapterView<?> arg0,
> View arg1,
> int arg2, long arg3) {
>
> // DO SOMETHING
> }
>
>
> });
>
>
> In my custom adapter layout. it contains 1 imageview, 2 textview in a
> linearlayout. Focusable & Clickable for imageview and both textview
> have been set to "false". Is this the correct way ?
You should not touch the focusable and clickable attributes of
ImageView or TextView -- the defaults are what you want.
If your activity is a ListActivity, you could override
onListItemClick() in the activity, instead of using
setOnItemClickListener().
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
_Android Programming Tutorials_ Version 2.9 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en