• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

App creates extra folder if name has spaces

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

In my android app the when the user create a project, it's created a folder in the external storage to later save the photos. If the name has no spaces everything works fine but when i put a name with spaces in the beggining it creates the folder but when i take a photo and save it the app creates an extra folder with for exmple, android%20app, it add the "%20" part i dont know why.

Creating the project:



Taking the photo in the project with spaces:

 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The obvious first question would be: why save something with spaces in it? Can you replace those with hyphens or underscores?
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying.

I think i can do that, just have to ask.
I actually never thought of that, but i would have to save the project's name in the DB also with the underscore or the hyphen right??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The DB should have no problems with spaces in strings.

Where does this "project name" come from? What I generally do is to keep the name of the directory where I store files on the device as a string in values/strings.xml. That way it's easily accessible in the app.
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the project name comes from the listview, is where i show all the projects
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my project, I think I'd store the files in predictably-named directories (maybe numbered) within a central app directory. Then the mapping between directory numbers and projects can be stored in the DB, or in shared prefs (if it's not too many), or maybe in a file by itself if you don't want to use the DB.
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's actually what i'm doing, it's not numbered folders but it's all saved in a central app folder. And the mapping between the folders and the projects it's stored in the DB.
 
Oh the stink of it! Smell my tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic