アプリはJSONデータを読み取ります。次に、それをリストビューに(正しく)配置しますが、アイテムを押した後、常に同じ値が表示されます。私が問題だと思うコードの下にありますが、私はそれを見つけることができません。
try{
JSONArray jArray = new JSONArray(result);
for(int ii=0;ii<jArray.length();ii++){
JSONObject json_data = jArray.getJSONObject(ii);
courseName = json_data.getString("fullname");
HashMap<String,String> map = new HashMap<String, String>();
map.put("fullname", courseName);
myCoursesList.add(map);
}
} catch(JSONException e){
Log.e("log_tag", "Error parsing data "+e.toString());
}
ListAdapter adapter = new SimpleAdapter(this, myCoursesList,R.layout.my_courses_layout,
new String[] {"fullname"}, new int[] { R.id.course});
setListAdapter(adapter);
ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view, int position, long id){
String fn = ((TextView)findViewById(R.id.course)).getText().toString();
Intent in = new Intent(getApplicationContext(), courseActivity.class);
in.putExtra("fullname", fn);
startActivity(in);
}
});