public void writeDatabaseToInternalStorage() {
   try {
     FileOutputStream fos = openFileOutput("database.xml", Context.MODE_PRIVATE);
     fos.write(xmlHandler.toString().getBytes());
     fos.close();
   } catch (Exception e) {
     Log.e(TAG, e.getMessage());
   }
 }
 public void writeDatabaseToExternalStorage() {
   if (getExternalStorageState() == EXTERNAL_STORAGE_READABLE_WRITEABLE) {
     try {
       File file = new File(this.getExternalFilesDir(null), "database.xml");
       OutputStream os = new FileOutputStream(file);
       os.write(xmlHandler.toString().getBytes());
       os.close();
     } catch (Exception e) {
       Log.e(TAG, e.getMessage());
     }
   }
 }