I’m trying to write a function that will delete every row in a given table but I’m getting a null pointer exception. Could somebody point me in the right direction? Here is the code…
public void deleteall(){
SQLiteDatabase db = tweets.getWritableDatabase();
String delete = "TRUNCATE FROM tweets";
db.rawQuery(delete, null);
}
Check if
tweetsis null.I think it’s more simpler to use this call, than using rawQuery.
Your rawQuery must be parsed, but using the delete method it uses already a parametrized query.