1

Check table rows whether it is empty or not

view story
linux-howto

http://stackoverflow.com – I'm working on dictionary database, I insert the query when the activity is first launch, it works smoothly, and at the next launch I want to prevent the insertion for the second time, I use this method to prevent insertion by checking whether the row is null or not, but it always rise a java null pointer exception in my logcat. public boolean isEmpty() { boolean empty = false; Cursor cursor = database.rawQuery("SELECT COUNT(*) FROM " + SQLiteHelper.DATABASE_TABLE, null); if(cursor != null) { cursor.moveToFirst(); if(cursor.getInt(0)== 0) { (HowTos)