@@ -0,0 +1,3187 @@
+package you.yourproject; //Change to match your own package%0A%0Aimport android.content.Context;%0Aimport android.content.res.AssetManager;%0Aimport android.database.Cursor;%0Aimport android.database.sqlite.SQLiteDatabase;%0Aimport android.util.Log;%0Aimport android.util.Pair;%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0Aimport java.io.InputStream;%0A%0A%0Apublic class Database %7B%0A%0A    Context context;%0A    Database(Context context)%7B%0A        this.context = context;%0A    %7D%0A%0A    String DBNAME = %22test.db%22;%0A    int initialVersion = 1;%0A%0A    public boolean isDBLocal()%7B%0A       return isDBLocal(DBNAME);%0A    %7D%0A%0A    public boolean isDBLocal(String checkDBName)%7B%0A        File deviceDB = context.getFileStreamPath(DBNAME);%0A        return deviceDB.isFile();%0A    %7D%0A%0A    public Pair getLocalVersion()%7B%0A        return this.getLocalVersion(DBNAME);%0A    %7D%0A%0A    public Pair getLocalVersion(String dbName)%7B%0A        SQLiteDatabase db = this.getDB(dbName);%0A        Cursor cursor = db.rawQuery(%22SELECT * FROM versions ORDER BY verID DESC LIMIT 1%22, null);%0A%0A        cursor.moveToFirst();%0A        String verNum = cursor.getString(cursor.getColumnIndex(%22verNum%22));%0A        String verNotes = cursor.getString(cursor.getColumnIndex(%22verNotes%22));%0A%0A        Pair info = new Pair(verNum, verNotes);%0A%0A        db.close();%0A        return info;%0A    %7D%0A%0A    public boolean updateVersion(int newVersion, String verNotes)%7B%0A        boolean is;%0A        SQLiteDatabase db = this.getDB();%0A%0A        db.execSQL(%22INSERT INTO versions (verNum, verNotes) VALUES('%22+newVersion+%22', '%22 + verNotes + %22') %22);%0A        is = true;%0A        db.close();%0A        return is;%0A    %7D%0A%0A    public boolean makeLocal()%7B%0A        boolean is = this.makeLocal(DBNAME);%0A        return is;%0A    %7D%0A%0A    public boolean makeLocal(String dbName)%7B%0A        boolean is;%0A        try%7B%0A            AssetManager am = context.getAssets();%0A            InputStream dbFile = am.open(dbName);%0A            FileOutputStream outStream = context.openFileOutput(dbName, Context.MODE_PRIVATE);%0A%0A%0A            byte%5B%5D fileBuffer = new byte%5B1024%5D;%0A            int read;%0A            while((read = dbFile.read(fileBuffer)) != -1)%7B%0A                outStream.write(fileBuffer, 0, read);%0A            %7D%0A%0A            SQLiteDatabase db = this.getDB();%0A            db.execSQL(%22CREATE TABLE versions (%22 +%0A                    %22verID INTEGER PRIMARY KEY AUTOINCREMENT,%22 +%0A                    %22verNum INTEGER,%22 +%0A                    %22verNotes TEXT)%22 );%0A%0A            this.updateVersion(initialVersion, %22New Local DB Installation%22);%0A%0A%0A%0A            Log.d(%22DB%22, %22DB was copied to local storage%22);%0A            dbFile.close();%0A            outStream.close();%0A            is = true;%0A        %7Dcatch(Exception e)%7B%0A            Log.d(%22DB%22, %22ERROR %22 + e.toString());%0A            is = false;%0A        %7D%0A        return is;%0A    %7D%0A%0A%0A    public SQLiteDatabase getDB()%7B%0A        return this.getDB(DBNAME);%0A    %7D%0A%0A    public SQLiteDatabase getDB(String dbName)%7B%0A        String dbPath = context.getFilesDir().toString() + %22/%22 + dbName;%0A        SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath, null, 0);%0A        return db;%0A    %7D%0A%0A    public void close(SQLiteDatabase db)%7B%0A        db.close();%0A    %7D%0A%0A%7D //End of Database class%0A

Create Database.java