Set the event handler callback on the list view:

ListView myListView = (ListView) findViewById(R.id.<your list id here>);
myListView .setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// do your thing here
}
});


-- Kostya

09.11.2010 13:47, pramod.deore пишет:
Hi, Thanks for reply,
but protected void onListItemClick(ListView l,View v,int POSITION,long
id)
       {
       }
method never called. (I can't ovverride it because my class is
extending from Activity and not from ListActivity).

On Nov 9, 2:43 pm, grace<[email protected]>  wrote:
On Nov 9, 1:55 pm, "pramod.deore"<[email protected]>  wrote:

Hi, I have one class which is extended from activity. In this I have
displayed list. Now I want the name of list item on which user is
clicked. My class is not exteded from ListActivity so I can't
override
protected void onListItemClick(ListView l,View v,int POSITION,long id)
         {
         }
    you can use the position value from the onListItemClick()and  get
the name from the adapter/list you have displayed.

Then How I came to know that on which list item user click?
Thanks.



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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

Reply via email to