Up vote 0 down vote favorite share g+ share fb share tw.
So basically, I'm trying to write a ContentProvider that encapsulates an SQLite database. I've looked everywhere online, followed several different tutorials, and keep on ending up with the same problem. I've noticed quite a few people asking the same question, but none of the advice there has helped me.
Basically, whenever I call "getWriteableDatabase" on my SQLiteOpenHelper, it throws a null pointer exception and nothing is created. Here's my code: public class DatabaseProvider extends ContentProvider{ private static int DATABASE_VERSION = 1; public static final String GRADE_COMPOSITION_TABLE = "gradecompositiontable"; public static final String GRADE = "Grade"; public static final String CLASS = "Class"; public static final String CLASS_CODE = "Class_Code"; public static final String ACTIVITY_CODE_TABLE = "activitycodetable"; //CLASS_CODE public static final String ACTIVITY_CODE = "Activity_Code"; MainDatabaseHelper dbHelper; @Override public Uri insert(Uri uri, ContentValues values) throws SQLiteException{ System.out. Println("Helper: " + dbHelper); dBase = dbHelper.
GetWritableDatabase(); ExecSQL("DROP TABLE IF EXISTS " + GRADE_COMPOSITION_TABLE); onCreate(db); } } I create this object from my main activity, and everything works fine until I call "insert", which is when it crashes. Android contentprovider sqliteopenhelper link edited 1 min agoTed Hopp40.7k42458 asked 7 mins agoCard1.
Please post the stack trace for the exception – Ted Hopp 2 mins ago.
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.