Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
LinkBack Thread Tools
Old September 23rd, 2010, 02:45 PM   #1 (permalink)
Junior Member
Thread Author (OP)
Join Date: Mar 2009
Posts: 30
Carrier: Not Provided

Thanks: 2
Thanked 4 Times in 2 Posts
Default Method for changing class in listview

down vote favorite
I have created a tabbed view with four tabs and attached four listviews to the tabs. I have created separate classes with the list views in them and I now want to add a activity to the list view
public class l2 extends ListActivity {

public void onCreate(Bundle icicle) {
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Accrington Stanley", "Aldershot Town", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe A", "Gillingham", "Hereford Utd", "Lincoln City", "Macclesfield T", "Morecombe", "Northampton T", "Oxford Utd", "Port Vale", "Rotherham Utd", "Shrewsbury T", "Southend Utd", "Stevenage", "Stockport C", "Torquay Utd", "Wycombe W"};
// Create an ArrayAdapter, that will actually make the Strings above
// appear in the ListView
this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_checked, names));

protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);

names = new intent().setClass(this, Bradford.class);
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
Toast.makeText(this, "You selected: " + keyword, Toast.LENGTH_LONG)
I have 24 teams in the listview and I have created a class for each one, but how can I make it so that when the user selects the team in the list it goes to the class in question i.e bury,bradfdord accrington ect.......?
What method should I use and how do I implement it. Thanks in Advance

JonniBravo is offline  
Reply With Quote
sponsored links

Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 07:45 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.