ListView click listener

Put your problem here if it does not fit any of the other categories.

ListView click listener

Postby Neosmithk » Fri Jan 01, 2010 2:28 am

Hey i was just wondering is there was an easy way to set up a click listener on list view items, i need to change the intent when a list view item in clicked on
Neosmithk
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 23, 2009 4:23 am

Top

Postby devboy » Mon Jan 04, 2010 11:55 pm

Is your class extending listactivity? If so, just override the onListItemClick like so.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.  
  3.     protected void onListItemClick(ListView l, View v, int position, long id)
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


And include your intent creation there.
User avatar
devboy
Freshman
Freshman
 
Posts: 9
Joined: Mon Dec 28, 2009 10:12 pm

Postby Neosmithk » Tue Jan 05, 2010 1:52 am

devboy wrote:Is your class extending listactivity? If so, just override the onListItemClick like so.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.     protected void onListItemClick(ListView l, View v, int position, long id)
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


And include your intent creation there.


ahha! yes it works now thank you!
Neosmithk
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 23, 2009 4:23 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], MSNbot Media and 22 guests