Getting Null Pointer Exception while reading sqlite database

Posted by user1597569 on Stack Overflow See other posts from Stack Overflow or by user1597569
Published on 2012-10-31T04:57:36Z Indexed on 2012/10/31 5:00 UTC
Read the original article Hit count: 102

Filed under:
|

I have to read values from SQLite database but getting null pointer exception when I execute

    private final String DB_NAME = "UserDb";
    private final String TABLE_NAMES = "tbluser"; 
    SQLiteDatabase sampleDB;
    Cursor c=null;



   c= sampleDB.rawQuery("SELECT * from " +TABLE_NAMES+" where did='"+deviceDec+"' ", 

null);

Please suggest me why I am getting the exception because at one function it is running but in other it is not. and the deviceDec value also i am getting I have checked in Log

© Stack Overflow or respective owner

Related posts about android

Related posts about sqlite