In my android application, I never checked db != null , while the queries work. I read what to check, for example, as in the following code.
SQLiteDatabase db = new ContactDbHelper( getApplicationContext()).getWritableDatabase(); if (db != null) { Toast.makeText(getApplicationContext(), "DB Contacts is created", Toast.LENGTH_LONG).show(); }else { Toast.makeText(getApplicationContext(), "Error create database!", Toast.LENGTH_LONG).show(); } The question is, do I need to check SQLiteDatabase db for null ? This is just a safety net and if so, for what reasons can the database not be created, provided that the code is working?