I have created the database in flutter using sqflite plugin. I created android home screen widgets for my app in android native. Now I need to fetch the data from SQLite. That is I am trying to fetch the data using Android Native sqflite Package from the SQLite db. Is that possible?
> There is No Limit on Flutter
Basic Rules of Sqlite, you need to remember
private fun accessDB(){
try {
GlobalScope.launch {
var db:SQLiteDatabase = SQLiteDatabase.openDatabase(getDatabasePath("epistle.db").absolutePath,null,SQLiteDatabase.OPEN_READWRITE);
Log.d(MainActivity::class.java.name , "Database Path "+db.path.toString())
Log.d("" , "Database version "+db.version.toString())
var cursor = db.query("userInfo",null,null,null,null,null,null)
cursor?.let {
while (cursor.moveToNext()){
var columnNames =cursor.columnNames
columnNames.forEach {
Log.d(
MainActivity::class.java.name,
"$it "+cursor.getString(cursor.getColumnIndex(it))
)
}
}
}
}
}catch (e:Exception){
e.printStackTrace();
}
}
MainActivity: Database Path /data/u
MainActivity: id 1
MainActivity: uid XfXCx613bKWl0EuDU
MainActivity: username Lee And May
MainActivity: email [email protected]
MainActivity: location US
MainActivity: isBiometricEnabled 0
MainActivity: isNotificationsEnable
MainActivity: morning 152.549
MainActivity: evening 166.529
MainActivity: plan Basic
MainActivity: lattitude 0
MainActivity: lognitude 0
MainActivity: userID XfXCx613bKWl0E
MainActivity: theme 2
MainActivity: premiumStartDate null
MainActivity: premiumEndDate null
MainActivity: isPremium 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With