且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

一个查询显示java.lang.NullPointerException错误

更新时间:2023-11-19 13:43:58

这是你的问题:

        public SQLiteDatabase getWritableDatabase() { 
            // TODO Auto-generated method stub 
            return null; 
        } 

您正在覆盖SQLiteDatabase类 getWritableDatabase 方法,做什么也没有(不打开数据库或任何东西)的的返回null,从而使导致了NPE。

You are overriding the SQLiteDatabase class getWritableDatabase method and doing nothing in it (not opening the database or anything) and returning null, so that leads to an NPE.

删除方法和你的NPE应该走了。

Delete that method and your NPE should go away.