Giter Site home page Giter Site logo

msoftware / dbexporterhelper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prabhat1707/dbexporterhelper

0.0 1.0 0.0 156 KB

This small Library Helps you to export db , export to csv and import db also work with Room db

License: Apache License 2.0

Java 17.86% Kotlin 82.14%

dbexporterhelper's Introduction

DbExporterHelper

This library Helps you to Export Db to sdcard or also import form it and also share db to csv to sdcard.

Images:

alt Setting IMages1

Prerequisites

  • Android 18.
  • Permission for excess of external storage.

Installing

Step 1:- Add it in your root build.gradle at the end of repositories:

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  

Step 1:- Add the dependency:


		dependencies {
	         implementation 'com.github.prabhat1707:DbExporterHelper:v1.0'
	}
	
  

Option 1:- Export db to external directory

First check the storage Permission then initilize it.

 ExportDbUtil exportDbUtil = new ExportDbUtil(this, db name, directory_name, this);
 /*
 db_path = "/data/com.example.android.databaseexpoter/databases/"
 */
  exportDbUtil.exportDb(db_path);

Option 2: Export all table to Csv

 csv_filename = "test.csv"
 exportDbUtil.exportAllTables(csv_filename);
 

Option 3: Export single table to csv

 exportDbUtil.exportSingleTable(first_table_name,csv_filename);
   

Option 4:Import db from external storage to internal

/*
 db_path = "/data/com.example.android.databaseexpoter/databases/"
 */
 
 if (exportDbUtil.isBackupExist(directory_name)) {
            exportDbUtil.importDBFile(db_path);
        } else {
            Toast.makeText(this, "no Backup", Toast.LENGTH_SHORT).show();

        }
   

CallBack Method are optional, "implements ExporterListener"


@Override
    public void success(@NotNull String s) {
        Toast.makeText(this, s, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void fail(@NotNull String message, @NotNull String exception) {
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
    }

For Any Query Mail me to "[email protected]"

Thanks

License

Copyright (c) delight.im <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable la
w or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

dbexporterhelper's People

Contributors

prabhat1707 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.