jeudi 25 février 2016

How to store GreenDao database on SD card

Hi I have created GreenDao Database.But my question is how to save the database on SD card and encrypt the database.

My code:

public enum GreenDaoExecutor implements BenchmarkExecutable {

        INSTANCE;

        private static String DB_NAME = "Hello_db";

        private DataBaseHelper mHelper;

        private DaoMaster mDaoMaster;

        @Override
        public void init(Context context, boolean useInMemoryDb) {
            mHelper = new DataBaseHelper(context, DB_NAME,
                    null);
        }

        @Override
        public long createDbStructure() throws SQLException {
            long start = System.nanoTime();
            if (mDaoMaster == null) {
                mDaoMaster = new DaoMaster(mHelper.getWritableDatabase());
            } else {
                DaoMaster.createAllTables(mHelper.getWritableDatabase(), true);
            }
            return System.nanoTime() - start;
        }

Aucun commentaire:

Enregistrer un commentaire