Hi I have a listview and I am trying to start an activity from the listview by {startActivity(class.java);}
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView;
public class ll2 extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] myList = 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"};
ListView lv = new ListView(this);
lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,myList));
setContentView(lv); }
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
if ("Bradford City".equals(MyList()[position]))
{startActivity(Bradford.java);}
}
}
I am getting a error with this line if ("Bradford City".equals(MyList()[position])) method myList() is undefined for the type ll2
I have tried allsorts of methods and I cannot get anything to work. All I want to do is for each team in the list have a separate java file(Class) With activities in them, Help I'm at my wits end.