Created
March 21, 2015 14:15
-
-
Save oznus/df2e21603dab54a76cbb to your computer and use it in GitHub Desktop.
Init Couchbase lite Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void initDB(Context context) { | |
| try { | |
| Manager manager = new Manager(new AndroidContext(context), Manager.DEFAULT_OPTIONS); | |
| if (!Manager.isValidDatabaseName(DBName)) { | |
| throw new RuntimeException("Bad database name"); | |
| } | |
| database = manager.getDatabase(DBName); | |
| } catch (IOException e) { | |
| throw new RuntimeException("Cannot create manager object"); | |
| } catch (CouchbaseLiteException e) { | |
| throw new RuntimeException("Cannot get database"); | |
| } | |
| Log.d (TAG, "Database created"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment