Guest User

Untitled

a guest
Jan 20th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. E/UncaughtException: android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
  2. #################################################################
  3. Error Code : 1032 (SQLITE_READONLY_DBMOVED)
  4. Caused By : Database or Journal file have been removed.
  5. (attempt to write a readonly database (code 1032))
  6. #################################################################
  7. at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
  8.  
  9. public void moveContents(){
  10. File destinationFolder = new File(DATABASE_FOLDER_PATH);
  11. File sourceFolder = new File(Environment.getExternalStorageDirectory() + "/AppName/Backups/_extracts");
  12. if (!destinationFolder.exists())
  13. {
  14. destinationFolder.mkdirs();
  15. }
  16. // Check weather source exists and it is folder.
  17. if (sourceFolder.exists() && sourceFolder.isDirectory())
  18. {
  19. // Get list of the files and iterate over them
  20. File[] listOfFiles = sourceFolder.listFiles();
  21. if (listOfFiles != null)
  22. {
  23. for (File child : listOfFiles )
  24. {
  25. try {
  26. File checkFile=new File(destinationFolder+"/"+child.getName());
  27. if(checkFile.exists()){
  28. checkFile.delete();
  29. FileUtils.moveFileToDirectory(child,destinationFolder,false);
  30. }else{
  31. FileUtils.moveFileToDirectory(child,destinationFolder,false);
  32. }
  33.  
  34. } catch (IOException e) {
  35. Log.e("FLERROR","ERROR",e);
  36. }
  37. // Move files to destination folder
  38. }
  39.  
  40. // Add if you want to delete the source folder
  41. sourceFolder.delete();
  42. }
  43. }
  44.  
  45. else
  46. {
  47. System.out.println(sourceFolder + " Folder does not exists");
  48. }
  49. }
Add Comment
Please, Sign In to add comment