SQLiteImporterExporter
A light weight library for exporting and importing sqlite database in android
How to Download
You can download the library using Nuget
Install-Package SQLiteImporterExporter -Version 1.0.0
How to use this Library:
This Library is used to import SQLite Database from Assets or External path and Export/Backup SQLite Database to external path.
SQLiteImporterExporter sqLiteImporterExporter = new SQLiteImporterExporter(ApplicationContext, db);
// Listeners for Import and Export DB
sqLiteImporterExporter.ImportListener = new ImportExportListener("I");
sqLiteImporterExporter.ExportListener = new ImportExportListener("E");
class ImportExportListener : SQLiteImporterExporter.Listener
{
private string v;
public ImportExportListener(string v)
{
this.v = v;
}
public void OnFailure(System.Exception exception)
{
Log.Error("mode : " + v, exception.Message);
}
public void OnSuccess(string message)
{
Log.Verbose("mode : " + v, message);
}
}
To Import SQLite from Assets
try
{
sqLiteImporterExporter.ImportDataBaseFromAssets();
}
catch (Exception ex)
{
ex.PrintStackTrace();
}
To import from external storage
try
{
sqLiteImporterExporter.ImportDataBase(path);
}
catch (Exception ex)
{
ex.PrintStackTrace();
}
To export to external storage
try
{
sqLiteImporterExporter.ExportDataBase(path);
}
catch (Exception ex)
{
ex.PrintStackTrace();
}
0 comments: