我有一个ListView,在这个ListView我有字符串数组。我想设置ActionListener这个ListView,但我不知道,也许是按索引查找。Activity当用户单击其中一个时,我必须转到下一个新的ListItems。
这就是我已经拥有的:
final ListView listview = (ListView) getActivity().findViewById(R.id.listview2);
final ReadSubjectSelectionListAdapter adapter = new ReadSubjectSelectionListAdapter(getActivity(), subject);
listview.setAdapter(adapter);
和:
public void loadSubjects(){
subject = new String[11];
for(int i=0; i<11; i++){
subject[i] = new String();
}
subject[0]=("Math");
subject[1]=("Kaz history");
subject[2]=("Kaz language");
subject[3]=("Rus language");
subject[4]=("Eng language");
subject[5]=("Physics");
subject[6]=("Chemistry");
subject[7]=("Biology");
subject[8]=("Geography");
subject[9]=("World history");
subject[10]=("Kaz literature");
}