android 取得listview中item的值publicvoid UpdataKehulist(){// 获取数据库的CursorCursor cur = m_MyDataBaseAdapter.fetchKehuData();miCount = cur.getCount();if (cur = null && cur.getCount() >= 0){ListAdapter adapter = new SimpleCursorAdapter(t
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 16:32:57
android 取得listview中item的值publicvoid UpdataKehulist(){// 获取数据库的CursorCursor cur = m_MyDataBaseAdapter.fetchKehuData();miCount = cur.getCount();if (cur = null && cur.getCount() >= 0){ListAdapter adapter = new SimpleCursorAdapter(t
android 取得listview中item的值
publicvoid UpdataKehulist()
{
// 获取数据库的Cursor
Cursor cur = m_MyDataBaseAdapter.fetchKehuData();
miCount = cur.getCount();
if (cur = null && cur.getCount() >= 0)
{
ListAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2,
// 数据库的Cursor对象
cur,
// 从数据库的NAME和YINGSHOUKUAN两列中取数据
new String[] {DBKehuAdapter.KEY_NAME,DBKehuAdapter.KEY_YINGSHOUKUAN },
// 对应的Views
newint[] { android.R.id.text1,android.R.id.text2 });
/* 将adapter添加到m_ListView中 */
kehuListView.setAdapter(adapter);
//编写listview被选中的事件
kehuListView.setOnItemClickListener(new OnItemClickListener() {
publicvoid onItemClick(AdapterView arg0,View arg1,
int arg2,long arg3) {
// 于对选中的项进行处理.这里我想知道选中的item的NAME和YINGSHOUKUAN的值,求教怎么弄?
}
});
}
}
android 取得listview中item的值publicvoid UpdataKehulist(){// 获取数据库的CursorCursor cur = m_MyDataBaseAdapter.fetchKehuData();miCount = cur.getCount();if (cur = null && cur.getCount() >= 0){ListAdapter adapter = new SimpleCursorAdapter(t
TextView tvLoc= (TextView) arg1.findViewById(android.R.id.text1);
应该是这样吧,主要看text1和text2是什么控件,相应改变TextView就行