listView.setOnItemLongClickListener(
new
OnItemLongClickListener() {
public
boolean
onItemLongClick(AdapterView<?> parent, View view,
final
int
position,
long
id) {
AlertDialog diaBox =
new
AlertDialog.Builder(
ListViewTestActivity.
this
)
.setTitle(
"Delete"
)
.setMessage(
"Really Delete?"
)
.setIcon(R.drawable.ic_launcher)
.setPositiveButton(
"YES"
,
new
DialogInterface.OnClickListener() {
public
void
onClick(DialogInterface dialog,
int
whichButton) {
SQLiteDatabase db=
null
;
if
(db==
null
){
db=openOrCreateDatabase(
"test.db"
, SQLiteDatabase.CREATE_IF_NECESSARY,
null
);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private
static
final
String Q_CREATE_TABLE=
"CREATE TABLE IF NOT EXISTS "
+ TB_NAME+
" (_id INTEGER PRIMARY KEY AUTOINCREMENT "
+
","
+
"title TEXT "
+
","
+
"contents TEXT"
+
");"
;
private
final
String Q_GET_LIST=
"SELECT * FROM test"
+
" ORDER BY +_id DESC"
;
public
class
DBManager
extends
SQLiteOpenHelper {
private
final
static
String TB_NAME =
"test"
;
public
static
final
String DB_NAME =
"test.db"
;
public
static
final
int
DB_VERSION =
1
;
public
static
final
String KEY_ID =
"_id"
;
private
int
_id=
0
;
public
static
final
String TITLE =
"title"
;
public
static
final
String CONTENTS =
"contents"
;
String quary ;
private
final
String Q_GET_LIST=
"SELECT * FROM test"
+
" ORDER BY +_id DESC"
;
public
DBManager(Context context) {
super
(context, DB_NAME,
null
,DB_VERSION);
quary =
"CREATE TABLE IF NOT EXISTS "
+ TB_NAME +
" (_id INTEGER PRIMARY KEY AUTOINCREMENT "
+
","
+
" title TEXT "
+
","
+
" contents TEXT "
+
");"
;
}
만든 db&테이블은 각각 이것인데 아무 에러도 안뜨고 삭제도 안돼요 ㅠㅠㅠㅠㅠㅠㅠㅠ
yes를 누르면 아무 반응도 일어나지 않습니당 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ