Up vote 0 down vote favorite share g+ share fb share tw.
Why SqlLite query in android produce Nullpointer exception I am using this code public void onCreate(SQLiteDatabase db) { String newTableQueryString = "create table " +TABLE_NAME +" (" + TABLE_ROW_ID + " integer primary key autoincrement not null," + TABLE_ROW_ONE + " text," + TABLE_ROW_TWO + " text" + ");"; Log. E("check","table have been created"+newTableQueryString); try{ mdb. ExecSQL(newTableQueryString);//it produce exception }catch(Exception e) { Log.
E("Exception"," "+ e.getMessage()); e.printStackTrace(); } } android sqliteopenhelper link|improve this question asked Feb 22 at 3:03Sandeep Tiwari446 55% accept rate.
– Connecting life with Android Feb 22 at 3:45 mdb is reference of DataBaseManager class which contains code of table creation.. – Sandeep Tiwari Feb 22 at 8:05.
My guess is mdb is null when you call: mdb. ExecSQL(newTableQueryString); Did you mean to invoke the execSQL method on the db method parameter that you're passing into the onCreate method?
This method is present in class DataBaseManager and I am making object of This class in Resume Method of launching Activity. – Sandeep Tiwari Feb 22 at 8:03 Take a look at the Activity Lifecycle. The onResume() method is not invoked until after onCreate(), so that is why mdb is null in the onCreate method.
– Mike Bockus Feb 22 at 13:29.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.