Android: good practices for organizing dirs and files on storage SD card?

Are there any guidelines where should my app store resource files downloaded from internet?


Asked by: Patrick983 | Posted: 20-01-2022






Answer 1

Here is an advice gleaned from the android developers forum:

There are two fairly common and well defined situations:

Situation: You need a temp file to do some processing that won't necessarily fit into memory.

Solution: Create the file, use it, delete it when you're done* Caveat: The file may be exceptionally large: demand an SDCard. The file contains sensitive information: use app storage.

Situation: You are operating a cache.

Solution: maintain the files in the supplied cache directory (Context.getCacheDir()), the system knows these can be deleted** Caveat: Big ticket items (like songs and videos) go to the sdcard (the user can treat these types as useful files anyway)

Answered by: Brooke891 | Posted: 21-02-2022



Answer 2

For future reference, now there are published guidelines: http://developer.android.com/guide/topics/data/data-storage.html

Answered by: Wilson669 | Posted: 21-02-2022



Similar questions

android - Best Practices for organizing different code for phone and tablet

I'm adapting an existing phone application for tablets. The problem is that there are some small differences in the UI between the phone and the tablet. For example, on the phone, there is a landing page and then a login page with a cancel button that goes back too the landing page. On the tablet, the login fragment is on the landing page and the cancel button is removed. This means that I've made a check ...


android - Organizing layout files using virtual folders

I'm working on a Android application that involves a lot of XML layout files. Since the Android tools don't allow subdirectories in the layout directory, I am trying to organize my project using Eclipse's virtual folders (I'm using Eclipse 3.7). Essentially, I'm trying to get functionality similar to Xcode's "groups". I'm able to create virtual folders, but when I try to add files to them I am given the message...


Organizing code files/XML files for Android SDK

Can someone provide some strategies as to organizing my project so that it is clean? Say I have a bunch of activities; is it good to place them all into a separate package, while putting other classes (such as custom Adapters) in another package to separate "logic" better? Also, when creating XML files for layouts, how would I separate the layout XML files logically if I have some layouts that are for certain activ...


organizing android apps in eclipse

I have an app on the iPhone and need to port it to android. For this I would like to group screen related files like classes and xml per screen in one "screen group" per screen somehow, ideally also strings and other value files if I use folders I can only group res files separately and src files separately. what would be the best way? Thanks very much! EDIT: If that should not be p...


java - Having Problems On Organizing Code In Packages

On my Android project I have the main Activity called TestFIO, which is in the package org.testing.file.io.main, and I tried to keep it clear and sent all the functions I had to a new class called FileManipulator, which is located at org.testing.file.io.main.manipulator. Here is how the FileManipulator class looks like: package or...


Organizing Activity in Android. States. Easy?

Please have a look at the graph: http://i.imgur.com/6FiGe.png I have some trouble with the architecture of my app. I have a few Activity/states that if you reach them you are not allowed to go back. These are K, A and X, so when you reach them and press back button you will close my app. It is very e...


android - Organizing Java Code with inner classes

this is a question of good practices and organization. In JavaScript, I'm used to organizing even small parts of code into objects like this: var init{ menu: function(){...}, navBar: function(){...}, connection: function(){...}, }; // And then call it like: init.menu(); init.navBar(); [...] I want to be able to do that, but haven't found a good way to doit. Grou...


android - What are the best practices for organizing the dimens.xml file?

My dimens file gets pretty big for a medium size app... Do you guys use generic dimen items like: activity_horizontal_margin, activity_horizontal_margin_x2, or do you name them according to the layout they are used in: "dimen name="activity_main_button_height" -30dp /dimen" ??? Thanks!


android - Best Practices for organizing different code for phone and tablet

I'm adapting an existing phone application for tablets. The problem is that there are some small differences in the UI between the phone and the tablet. For example, on the phone, there is a landing page and then a login page with a cancel button that goes back too the landing page. On the tablet, the login fragment is on the landing page and the cancel button is removed. This means that I've made a check ...


android - Organizing Code in Java

Closed. This question needs to be more focused. It ...


Organizing resources in Android studio

I'm working on a project with a lot of .xml layout files. I want to organize them in separate folders. It seems like Resource Merging would be the right solution. http://tools.android.com/tech-docs/new-build-system/resource-merging I want to split my layout folder in activity, listview, dialog, butt...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top