0
我使用SimpleCursorAdaptor加载了一列使用2列的列表视图。该代码是:如何访问ListView中的项目SimpleCursorAdaptor
mCursor = managedQuery(MyobiliseData.CONTENT_URI, projection, null, null, null);
//3. Attach the data to the listview using an adaptor
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.list_item_custom_font,
mCursor,
new String[]{MyobiliseData.Columns.CUSTOMER_NAME,MyobiliseData.Columns.ADDRESS},
new int[] {R.id.text1,R.id.text2}
);
listView1.setAdapter(adapter);
当在列表中的项目中选择我试图访问数据,但我不知道该用什么类型的对象 - 当我使用HashMap对象,失败,即
HashMap<String, String> item = (HashMap<String,String>) listView1.getAdapter().getItem(position);
任何帮助最受赞赏。
感谢
1000感谢你的! – WaterBoy
不客气。 – jeet