The moose likes Android and the fly likes Help with clickable Listview Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "Help with clickable Listview" Watch "Help with clickable Listview" New topic
Author

Help with clickable Listview

jonathan d roberts
Greenhorn

Joined: Sep 24, 2010
Posts: 1
Hi

I have 24 teams in a list, I have 24 separate .java classes for each team with information about those teams. When the user clicks on an item(Team) in the list I want to it to goto that teams java file(Class) and display there information. below is the code,






What I want to happen is when a user selects the team Bradford say, I want it to goto the Bradford.java class and if someone selects Accrington I want it to go to the Accrington.java class.

Thanks in Advance
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9090

startActivity method takes an Intent as an argument, not a java file name. You can make the class of your intent dynamic using reflection API (see example here). Another approach to this would be to assign a different action to each of your activity classes and invoke an action instead of a specific class using an Intent (in reality I'm not even sure if Bradford.java and Accrington.java even contain an activity or a normal class)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Antony Keerthy
Greenhorn

Joined: Mar 29, 2011
Posts: 1
You can use like this




For this listactivity example you can also view http://android-codes-examples.blogspot.com/2011/03/listactivity-with-checkbox-using.html
 
 
subject: Help with clickable Listview
 
Threads others viewed
How to get the complete path of file from android application
Unable to read more than one text files stored in sdcard
Problems with listview and checkbox event
webview help......
How to add new country and flag in the list view
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com