Can I create folder for storing files besides RAW folder? - android

can i create folders, besides raw folder, for storing different kind of files?
For examples, my application need to count all the images put in a folder.
So, I need a specific folder for images only, and other folders for sounds, for .txt etc!
But when i tried to create a new folder, I couldn't reach it :(

It is just a hunch, but you might have more luck using the assets folder instead. You can certainly use it to store embedded web sites which have subfolders.

In general you cant create custom resource folders. But you can use assets dir and place your resources there. You can make as much subfolders in assets dir as you need. But android won't help you to manage your files in assets dir. Read this.

Related

Android, difference between assets folder and internal storage

Following are my understanding of them, and want to make sure it's correct.
Assets folder is a directory that I can place files so app can use.
This is immutable folder.
Internal storage is a directory you are given when your app is installed.
You can mutate files under this directory.
If I maintain a read-write sqlite database, I will probably make it here under internal storage.
If I want to provide an initial database though, I would have to place it under the assets folder, and copy it when app is first run.
Yes, your understanding is correct. The difference between the Assets folder and the Internal Storage folder is that the Assets folder can't be changed at runtime. So the usage of internal storage and assets folder is as follows-
1) When one has fixed content like fonts,images,styles,string values,etc. put it into the assets folder.
2) If based on the programme the values must change based on the situation then save those values in the Internal Storage.
Yes you're right. The difference is that assets folder is read only folder. You can put your files there and use them in your app but if you need to change or modify them, you should copy them from assets to internal then do your works, so if you have static texts or fonts or files that needs nochange you can put them in assets folder but if you have database files you should copy ithem to internal.

More folders in raw folder

So guys, I have a lot of mini sounds in mys application, but it would be a lot easier if I could organize them in folders like \res\raw\foldername. I tried it but i can load only from R.raw and it shows only samples from "raw" folder. Any idea how to do this?
Thanks
I'm not sure if you can do this with raw, but and alternative solution would be to put the files organized into directories, into assets folder, and then read from there.

Loading files from raw folder in Android

Suppose I store various images in raw folder. However, my own code first learns of the file names at runtime. (It reads a text configuration file at startup.) Is it possible to then search "raw" folder in my android app and if found, load image from raw into imageview?
Okay, thanks to Mario I got on track to doing some research. These 5 SO's explain everything:
Android images in /assets or res/raw
Reading assets or raw or resource files as a File object in Android
How to reference a File in raw folder in Android
Check for file existence in androids assets folder?
Difference between /res and /assets directories

put res folder on android apk expansion file

I have an application with a lot of data resources in the res-drawable folder, is it possible to put the res folder in expansion file or i need to make changes in the code? i tried to read about this in the expansion files documantation but cant figure it out.
is it possible to put the res folder in expansion file
No, sorry.
i need to make changes in the code
Yes.

copying Folder to another folder which copy all content recursively

i want to copy folder1 to the folder2.now folder1 consists of many folders and files also and so on..How can i program that all the files and folders will copy to the Folder2.I know the logic to copy a single file to a folder..
Similar problems in other platforms often use recursion.
Save some time and use the Jakarta FileUtils.copyDirectory()

Categories

Resources