Langsung ke konten utama

Postingan

Menampilkan postingan dengan label android sqlite

SQLite Importer Exporter - Library

A light weight library for exporting and importing sqlite database in android Created By How to Download Gradle: compile 'com.ajts.androidmads.sqliteimpex:library:1.0.0' Maven: <dependency> <groupId>com.ajts.androidmads.sqliteimpex</groupId> <artifactId>library</artifactId> <version>1.0.0</version> <type>pom</type> </dependency> 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(getApplicationContext(), db); // Listeners for Import and Export DB sqLiteImporterExporter.setOnImportListener(new SQLiteImporterExporter.ImportListener() { @Override public void onSuccess(String message) { Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); } @Override public void onFailure(Exception exception...

Room Android Architecture

In Google I/O 2017, Google announced about Room Architecture for Android. This Architecture is used to maintain the State of Android Application when the orientation changes. As well as google announced about Room Architecture. Room We have more boiler plates while creating SQLite Database in Android even it is small. Room as a library used to remove the boiler plates like Cursors & Handlers and database can be handled with annotations and model classes. If we remember about Sugar ORM or Active Android , the same approach is dealt with Room.  We don't want to go for any third party libraries, when the official Android libraries give you an equal, or better solution. Life Cycle Activity We have faced the problem mostly as that  to maintain the State of Android Application when the orientation changes. The Life Cycle Activity used to handle the state easily. Coding Part Create a new project in Android Studio. First, Add Google’s maven repository to your project-level build.g...

SQLiteToExcel v1.0.1

This is a Light weight Library to Convert SQLite Database to Excel and Convert Excel to SQLite. I have already released version 1.0.0 . It is suitable to export SQLite Database to Excel. But, In version 1.0.1 I have Included following features Features Added Functionality to Import Excel into SQLite Database. Added Functionality to Export Blob into Image. Added Functionality to Export List of tables specified. Sample App The sample app in the repository is available on Google Play: How to Download Add the following library in your app level gradle file compile 'com.ajts.androidmads.SQLite2Excel:library:1.0.1' How to Use Add Permission to Read External Storage in AndriodManifest.xml <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Export SQLite to Excel This line is used to save the exported file in default location. SqliteToExcel sqliteToExcel = new SqliteToExcel(this, "helloworld.db"); This line is used to save the exporte...

How to use External SQLite DB in Android

In this Post, I will explain how to import and use External SQLite DB in Android. You can import and use SQLite database with the extensions like .db, .db3,sqlite and sqlite3. The External DB is created with some desktop applications like SQLite Browser , SQLite Converter and so on. After Generating the DB paste that into your App's assets folder. Code: DBHelper.class Create a class named as DBHelper extending with SQLiteHelper . Paste the following code in that class. public class DBHelper extends SQLiteOpenHelper { Context context; String DB_PATH; String divider = "/"; String DB_NAME; public DBImporterExporter(Context context, String DB_NAME) { super(context, DB_NAME, null, 1); this.context = context; this.DB_NAME = DB_NAME; DB_PATH = divider + "data" + divider + "data" + divider + context.getPackageName() + divider + "databases/"; } public boolean isDataBaseExists() { Fi...