当用户单击列表视图中的项目时更新表列

时间:2014-04-22 03:41:39

标签: java android listview

我希望在用户点击listview中的项目时通过设置onclicklistener来更新表格这里是我的代码

view_list.setOnItemClickListener(new OnItemClickListener()
    {

         public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
    {
             String click = (addArrrayList.get(arg2).toString());
            shoppingListDB.rawQuery("UPDATE ITEMS SET FOUND = 'YES' WHERE ITEM_NAME ="+ "'" +click+"'", null);

    }

    });

1 个答案:

答案 0 :(得分:0)

现在正在使用,我已将rawQuery更改为execSQL

String update = "UPDATE ITEMS SET FOUND = 'YES' WHERE ITEM_NAME =" + "'"+click+"'";
            shoppingListDB.execSQL(update);