This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 166
1
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: 166
1
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!