我正在尝试学习如何在单击单选按钮时接收通知,ListView
但是当我单击项目旁边的单选按钮时没有任何返回ListView
。下面是我设置监听器的代码。我在从服务器onPostExecute()
填充我的方法ListView
和我的主要活动扩展的方法下在异步任务中执行此操作MapActivity
。有谁知道我做错了什么?
protected void onPostExecute(ArrayList<String> result) {
// ... some code
mapView.postInvalidate();
final ArrayAdapter<String> arrayAdpt = new ArrayAdapter<String>(
getApplicationContext(), android.R.layout.simple_list_item_single_choice,
viewline);
ListView restaurant_list = (ListView) findViewById(R.id.list);
restaurant_list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
restaurant_list.setAdapter(arrayAdpt);
restaurant_list.setScrollContainer(true);
restaurant_list.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Log.e("listargs", (String.valueOf(arg1)) + " " + String.valueOf(arg3));
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});