开发者

Why can't I delete using a getContentResolver..?

I can get the data with NO problem...but I cannot delete the data. Any Suggestions..??

                Cursor cu = getContentResolver().query(CONTENT_URI, null, null, null, null);
            if (cu.moveToFirst())
            {
                numberInDb = cu.getString(2);
                System.out.println("Number in DB = " + numberInDb);
            }

            ContentResolver c = getContentResolver();

NEITHER OF THESE NEXT 2 LINES WORK

            c.delete(CONTENT_URI, "TIT开发者_如何学JAVALE ="+ numberInDb, null);
            getContentResolver().delete(CONTENT_URI, "TITLE ="+ numberInDb, null);


If TITLE is a string, I suspect that you need to quote it in your query:

getContentResolver().delete(CONTENT_URI, "TITLE ='" + numberInDb + "'", null)

Also, check the logcat output and see if there are any SQLite errors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜