If I wanted to put a bunch of images in a folder structure, e.g.. I’m building a beach app and each beach is displayed via my beach detail activity depending on the beach selected from my beach list. I then want to display five images from that particular beach. Each beach will have a folder with a name that corresponds to the _id of the beach and then five images in that folder, image1.jpg, image2.jpg… image5.jpg. should I put the folders and images in the /res/raw folder or the /assets folder for the best/easiest way to go.
Cheers,
Mike.
Assets will allow you to create subdirectories (group files in directories) note that they have no name restrictions however you can only access it via Assets Manager which contains list() for listing files under a given directory and open() for obtaining a file’s InputStream.
resources instead, allow you to access the files in the folders but you cannot create subfolders, moreover you must place the files in the right place so bitmaps go in
/res/drawable, layout xmls in/res/layoutand so on. Resouces are easy to access for other parts of your code since they have an identifier.Since you want to use the
res/rawfolder that means you cannot create a subfolder in it and that your images won’t be compressed, so putting them without compress and considering they will be a lot of images then you app will be a bit heavy.Here is two links that you might find helpfull: WiseAndroid and Providing Resources – Dev Guide