• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Writing Permission Issue  RSS feed

 
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem with my backup and restore of a database in my Android App.

I have a few different problems.  The first is it won't create the directory, even though I have write permissions -



The logcat is -



Then, with a backed up database that works fine on other phones, the import wont work either -



The logcat looks like this -



So no errors.  It doesn't say it can't find or access the file, it just seems to ignore the contents of it?

Any ideas?
 
Ranch Hand
Posts: 197
2
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the first code, you getting "Directory is not created" is because the directory is not created.
Modify your code to this way
 
Andy Crowther
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'll try, but does that not try and make the directory twice?  From what I read, putting it right into the IF statement tried to make it and based the IF statement off the result?
 
Andy Crowther
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To confirm.  I get the same result.
 
Randy Tong
Ranch Hand
Posts: 197
2
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still getting "Directory is not created" ?
 
Andy Crowther
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.  In my code, I actually had the line you suggested already there, but commented out. I think I'd tried it before.
 
Andy Crowther
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, so I needed to ask for permission at run time.  For anyone else with this problem, my code is now -



I will make a new thread for the reading database issue I think, as the thread title isn't really appropriate for that.
 
She'll be back. I'm just gonna wait here. With this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!