我有下面的代碼訪問ListView的項目值到字符串中,並顯示在警報?如何獲得在Android中單擊的Listview項目的值?
ListView shot = getListView();
shot.setOnItemClickListener(this);
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
String S = arg1.getContext().toString();
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
// set the message to display
alertbox.setMessage(S).show();
}
請多花點心思問問題。我無法完全理解你的問題。你想做什麼?什麼工作什麼不是? – Janusz 2010-06-07 10:02:59
提示:請勿使用'arg0','arg1'等作爲參數名稱。它使源代碼完整無法讀取。其中之一就是你正在尋找的信息,所以如果你使用了正確的名字,你就不需要問這個問題。 – RoToRa 2010-06-07 10:18:20