Simple way to peek your DB Sql without third party app.
Add maven jitpack.io
and dependencies
in build.gradle (Project)
:
// build.gradle project
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
// build.gradle app/module
dependencies {
...
implementation 'com.github.gzeinnumer:PeekDatabase-V2:version'
}
Show All table for sqlite
Java
//with sqlite
SQLiteDatabase sqLiteDatabase = DBInstance.getDataBase(getApplicationContext());
//with room
//SQLiteDatabase appDatabase = AppDatabase.getDatabase(getApplicationContext()).getSQLiteDB(getApplicationContext());
btn.setOnClickListener(view -> {
DialogTableBuilder
.newInstanse(this, sqLiteDatabase)
.build();
});
//spesial for Room
public SQLiteDatabase getSQLiteDB(Context context) {
return SQLiteDatabase.openDatabase(context.getDatabasePath(dbName).getPath(),null,SQLiteDatabase.OPEN_READWRITE);
}
Show spesific
DialogTableBuilder
.newInstanse(this, sqLiteDatabase)
.addTable("table1")
.build();
String[] tables = {
"table1",
"table2"
};
DialogTableBuilder
.newInstanse(this, GblVariabel.myDb)
.addTable(tables)
.build();
- 1.0.0
- First Release
You can sent your constibution to branch
open-pull
.
Fore More All My Library
Copyright 2022 M. Fadli Zein