Hi, I have created four tabs with listview in each. I have been attempting to make the list views clickable, I have used the listview tutorial from Here to create the list view using string.xml and R.array:
The problem is when I use my intent and onItemClickListener I get multiple marker errors, if I play around with the commas brackets and class body markers the errors move around, so is it the syntax that's the problem or is it the lay out or postion of the code;
public class ll2 extends ListActivity {
static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String[] TEAMS = getResources().getStringArray(R.array.twoteams_array);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, TEAMS));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
public void onListItemClick(ListView, parent, View v, int position, long id);
}
if (position == "Braford City") {
Intent intent = new Intent(this, Bradford.class);
startActivity(intent);
}
}
I get these errors here:
static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};
Syntax error, insert "}" to complete ClassBody
If I add to complete class body I get more erros here and in other places.
I get these errors here:
public void onListItemClick(ListView, parent, View v, int position, long id); }
Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error, insert ";" to complete LocalVariableDeclarationStatement - Syntax error on token ",", ; expected - Syntax error on token "(", = expected - Syntax error on token ",", ; expected - Syntax error, insert "}" to complete MethodBody - Syntax error, insert "}" to complete ClassBody - Syntax error on token "}", delete this token
Same problem here I have tried different combinations and it gives me errors constantly with this setup I have the least amount of errors
Any help greatly appreciated