我想選擇在ListView中的項目,並顯示用戶他選擇的項目,但是當我點擊列表項沒有任何反應。ListView中選擇項
songtitle
是ListArray ....
ArrayList<String>songtitle = new ArrayList<String>();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.song,songtitle);
setListAdapter(adapter);
上述這部分是一個概要,而不是實際的代碼。該部分起作用。下面的方法沒有。
protected void onListIemClick(ListView , View v, int position, long id){
super.onListItemClick(c, v, position, id);
Toast.makeText(this, "You have chosen the color: " + " " + songtitle, Toast.LENGTH_LONG).show();
}
可能重複的[檢測哪個項目是從ListView中選擇的](http://stackoverflow.com/questions/8196552/detecting-which-item-was-selected-from-a-listview) –