/DatabaseQueryHandler.java Secret
Created
October 5, 2017 15:32
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This class is used to write all Abstract (Insert, Query, Update, Delete) methods. | |
public class DatabaseQueryHandler { | |
private SQLiteDatabase mSqLiteDatabase; | |
private Context mContext; | |
//Default Constructor | |
/*Here I have created parameterised constroctor with context and isWritable as parameters. The boolean value of isWritable allows me to get readable or writable instance of SQLite Database */ | |
public DatabaseQueryHandler(Context context, boolean isWritable) { | |
DatabaseHelper databaseHelper = DatabaseHelper.getInstance(context); | |
mContext = context; | |
if (isWritable) { | |
mSqLiteDatabase = databaseHelper.getWritableDatabase(); | |
} else { | |
mSqLiteDatabase = databaseHelper.getReadableDatabase(); | |
}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment