public class DatabaseManager
extends java.lang.Object
MediaItemsAbstractController
and by CategoriesController
)Modifier and Type | Class and Description |
---|---|
class |
DatabaseManager.DBImportValidationException
An exception thrown during DB import if data has some validation error
|
Modifier and Type | Method and Description |
---|---|
void |
exportDatabase(Context context)
Function to export the application database to a JSON file.
|
static DatabaseManager |
getInstance()
Singleton pattern
|
void |
importDatabase(Context context,
Uri fileUri)
Function to import the application database from a JSON file
|
public static DatabaseManager getInstance()
public void exportDatabase(Context context)
context
- the contextpublic void importDatabase(Context context, Uri fileUri) throws DatabaseManager.DBImportValidationException, java.io.IOException, JSONException
context
- the contextfileUri
- the URL of the fileDatabaseManager.DBImportValidationException
- if something went wrong with the importjava.io.IOException
- if the file cannot be accessedJSONException