我的onitemclick部分代码是.....
我有三列id标题和notetext,当我从listview点击标题时,我只想显示我的sqlite数据库列(notetext)中的文本。
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
{
Cursor cursor = (Cursor)arg0.getItemAtPosition(arg2); // i m getting error here
String product = cursor.getString(cursor.getColumnIndex("notetext"));
Intent myintent = new Intent(getApplicationContext(),view1.class);
myintent.putExtra("product", product);
startActivity(myintent);
}
});
答案 0 :(得分:0)
答案 1 :(得分:0)
试试这段代码
cursor.moveToPosition(position);
String product = cursor.getString(cursor.getColumnIndex("notetext"));