如何从我的数据库中删除单击的项目...我是android的新条目

时间:2011-09-29 15:14:52

标签: android onitemclicklistener

    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {

            AlertDialog.Builder adb=new AlertDialog.Builder(activity2.this);
            adb.setTitle("Delete?");
            adb.setMessage("Are you sure you want to delete " + arg0);

            adb.setNegativeButton("Cancel", null);
            adb.setPositiveButton("Ok", new AlertDialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Toast.makeText(getApplicationContext(), "Delete", Toast.LENGTH_LONG).show();

0 个答案:

没有答案