• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

App creates extra folder if name has spaces

 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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:

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42969
73
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
the project name comes from the listview, is where i show all the projects
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic