Context. getcachedir ()/Data/CacheThese files will be ones that get deleted first when the device runs low on storage. There is no guarantee when these files will be deleted.However, it is best not to rely on the system for management. You should set a maximum capacity and delete it when the value exceeds.
Context. getfilesdir (), context. openfileoutput (string, INT), context. getfilestreampath (string), context. getdir (string, INT)/Data/FilesAndr
1, through the Context.getexternalfilesdir () method can get to sdcard/android/data/your app's package name/files/directory, usually put some long-time saved dataThe Context.getexternalcachedir () method allows you to get to sdcard/android/data/your app package name/cache/directory, typically storing temporary cache dataAnd the "Clear data" and "clear cache" options in the above two directories correspondin
Android data storage file and android Data StorageIn the previous article, we used SharedPreferences to save data in Android. SharedPreferences mainly saves the setting information of some applications or a small amount of user information when saving data, the String class information stored in the form of key-value h
Data storage in Android (2): android Storage
In the previous article, we introduced how to use SharedPreferences.
Today, we will continue to introduce another way to store data: using internal storage and external
One. Create1./src/main/assets2. Switch to Project view mode and create a new folder under Main assetsTwo. Features1. Same level as Res2. Mainly to store large files in the project3. File is not managed by R classThree. API1.AssetManager Asset Manager1-getassets () Get asset manager2-open (file name) returns the InputStream of the file2.imageview:setimagebitmap (Bitmap instance) to set a bitmap for a picture view3.Bitmap bitmap: bitmapfactory.decodefile (picture file
Xirihanlin 2011.06.03
Original path: http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/
In the previous article, I explained why it is difficult for us to use internal and hidden APIs without reflection. This is because Android. jar doe
Android data storage and android Data StorageSharedPreferences and Editor
As long as SharedPreferences stores data in a format similar to configuration information, SharedPreferences stores data in a simple key-value pair. Diagram below
We can see that the internal class Editor of SharedPreferences is used for
methods are similar to these. They are classified as files, databases, and networks in general. But from the developer's point of view, it can be divided into the following five methods:1. SharedPreferences sharing preferences2. Internal Storage space3. External Storage4. SQLite Database5. Internet NetworkThese methods have their own advantages and disadvantages. They should be selected based on different
. getExternalStorageDirectory (); sdCard = new File (sdCard, "/MyFiles/" + FILENAME); FileInputStream in = new FileInputStream (sdCard ); reader = new BufferedReader (new InputStreamReader (in); String line = new String (); while (line = reader. readLine ())! = Null) {data. append (line);} dataView. setText (data);} catch (FileNotFoundException e) {dataView. setText ("No stored data found");} finally {reader. close ();}}}
Run the program and click "save data". After the Toast is successfully sa
In Android, some areas of internal storage must be reserved for the system to run applications.
However, this is not taken into account in the native Android design. internal storage can be fully filled.
This will cause sqlitefull
: ** the internal storage path of the APP is specified by the package name of the APP and placed in a special location in the Android file system. Technically speaking, other apps can read your internal files if the file mode you set is readable. However, other apps should a
Android learning 10 (android file storage) and android file storage
The android system provides three methods for simple data persistence, namely file storage, SharePreference
Xirihanlin 2011.06.07
Original path: https://devmaze.wordpress.com/2011/01/19/using-com-android-internal-part-5-summary-and-example/
To be able to use internal and hidden APIs, You need:
1. Create a custom original-android.jar that contains all. class files
2. Create a custom
:
Environment.getExternalStorageState()3. Obtain the remaining sd space:
Environment.getExternalStorageDirectory().getUsableSpace();2. Save data to an internal storage device (/data/package name /)
Private application folder. By default, other applications cannot access it. This ensures data security.
Context. getFilesDir () =/data/package name/files user file directoryContext. getCacheDir (
has been on the phone settings in the RAM and internal storage space do not understand, do mobile phone for three years I was confused, and in addition today the Boss let me divide the NAND region as a cell phone internal storage use, I completely paste, and then determined to understand the following several concepts:
Public voidBT3 (View v) {Try { //writing files from memory//1. Get the internal storage directoryFile file=Getfilesdir (); String s=File.getabsolutepath (); Toast.maketext (mainactivity. This, "path=" +s, Toast.length_short). Show (); //2. Writing to a file with an output streamFileOutputStream fos=openfileoutput ("Test.txt", mode_private); //3. Writi
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.