-1

有可能获得单行的值。在partycular 中,我不会在带有适配器的 mt 列表行中获取字符串中的 id 值。

在每一行中都有值 id 和 label

非常感谢,对不起我的英语

ListView list;
            list = (ListView) findViewById(R.id.listView1);
            mSchedule = new SimpleAdapter(getApplicationContext(), result ,R.layout.row_meteo,
                    new String[]{"id", "label"}, new int[] {R.id.textView1,R.id.textView2});
            list.setAdapter(mSchedule);

            list.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
                    String idPlace = mSchedule.getItem(position).toString();

                    Toast.makeText(getApplicationContext()," Cliccato sul luogo :"+idPlace,Toast.LENGTH_LONG).show();


                }
        }
4

2 回答 2

1
 public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {


                    TextView tv  = (TextView)view.findViewById(R.id.textView1); //<---------
                    String str = tv.getText();


                }
于 2012-06-25T14:17:58.650 回答
0

代替

String idPlace = mSchedule.getItem(position).toString();

String idPlace =((TextView)view.findViewById(R.id.textView1)).getText().toString();
于 2012-06-25T14:20:23.987 回答