Android newest mobile phone internal storage size, SD card storage size Method
We used to obtain this information in the past.
// Before Android API18: fs. getAvailableBlocks () * fs. getBlockSize ()
Currently:
/** Obtain available system memory **/@ SuppressLint ("NewApi") private String getMemFree () {S
SharedPreferences is also a lightweight data storage method.The essence is to store key-value pairs of data based on XML files.Is usually used to store some simple configuration information. Its storage location is/Data/
/Shared_prefs
Directory. Read SharedPreference 1. Get SharedPreference object/** Name: name of the SharedPreferences file opened by name (. xml suffix is not required)* SharedPrefe
) {e.printstacktrace ();
catch (Unsupportedencodingexception e) {//TODO auto-generated catch block E.printstacktrace (); Catch(IOException e)
{//TODO auto-generated catch block E.printstacktrace ();
}
}
});
}
}
Data/data/packagename/files/test is the file we write.
SD storage (External storage)The Mnt/sdcard directory is the mount point of the SD card (just a point)
There are five ways to store data on the Android platform:1. File storage data;2. Use sharedpreferences to store data;3. SQLite database stores data;4. Use contentprovider to store data;5. network storage data;Here we will introduce file storage:The file storage method is a commonly used method. It reads/writes files i
Some of the application's configuration files need to be stored on the phone. Generally divided into internal storage and SD card storage.One. Internal storage, to FileOutputStreamNew File (Getfilesdir (), "User.txt"); // Open local File preparation record Try { new fileoutputstream (file); Fos.write (User+ # # # +pass). GetBytes ());
Android can be used to store two places, one is the phone built-in storage space, an external SD card, the built-in storage space is generally relatively small, so the application of the cache is recommended to store the external SD card.How do I get the path to the storage in the
ContentProvider encapsulates database operations and shares data. That is to say, the data storage implemented by ContentProvider can be accessed in external applications. The specific process is as follows:
I. Extended ContentProvider class provides data access interfaces
Extends the SQLiteOpenHelper class to create and update database tables. For more information, see the previous blog)
Note: We recommend that you extract the table name and column n
4. File: a traditional I/O Stream storage File. Activity provides the openFileOutput () method to output data to a File, the specific implementation process is the same as saving data to a file in the J2SE environment. The following example shows how to save, read, and save a file on the SD card. (1) save the file and copy code 1 public void save (String str) {2 3 try {4 FileOutputStream output = this. openFileOutput ("test.txt", Context. MODE_WORLD_R
1. Modify the storage drive letter name of the Android device
(Note: tbdg1073 is my project name)
1. Modify the device/other/tbdg1073/system. Prop file.
2. Modify the Ro. Media. patition. Label attribute to ouyangpeng.
3. Re-compile after modification
4. Connect the mid to the computer via USB. The drive letter is ouyangpeng.
2. Modify the Android device mode
This article describes 5 ways to store data in Android.
Data storage is the most frequently used in development, and here are 5 ways to implement data storage in the Android platform, respectively:
1 Storing data using sharedpreferences
2 File storage Data
3 SQLite Database
Objective:In our app development process basically will use the file storage, so file storage for us is quite familiar with, but since the release of Android 6.0, access to external sdcard based on the runtime permissions mechanism is required to dynamically request permission, So the previous direct SDcard root directory directly to create a new xxx/cache/ direc
1 Scheme designIn a variety of application design requirements, it is possible to refer to the file storage path selection problem. This article describes the Android application involved in allowing the selection of SD card and cell phone storage, the initial scenario: (1) in the case of the phone installed SD card, the preference is stored in the SD card, when
Three File data external storage
Each Android device supports a shared "external store" that you can use to save files. This could be a removable storage medium (such as an SD card) or an internal (fixed) store. Files saved to the external store are public and can be modified by the user.
Note: Files on external storage
Android learning 10 (android file storage)
The android system provides three methods for simple data persistence, namely file storage, SharePreference storage, and database storage. You
Android 14th --- SQLite of Android heavyweight data storage --- androidsqlite
Preface
Unconsciously, the Android basic series has written 13 articles, which are 14th articles ~ The previous blog recorded a data storage solution in And
Brief introduction:This article describes how developers ' apps use media storage services (including Mediascanner, Mediaprovider, and media information parsing) in Android, and how to update the app's new or modified files to the media database, How to hide the files generated by the app in the multimedia application, how to monitor the changes of the media database and so on.Android has an original set of
Needless to say, the operation of the database is immediately followed. Come on!When it comes to data storage problems, the database has to be mentioned. A database is an ideal tool for storing relational data. Android provides a powerful database support for developers to easily construct database-based applications. Android's database application, based on the most popular open source embedded database SQ
Virgins Android (13th) --- SharedPreferences and sharedpreferences for lightweight Android Data Storage
I. Preface
Reprinted please indicate the source: http://blog.csdn.net/wlwlwlwl015/article/details/42437007
When I was a beginner in Android, I used the Intent + Bundle mode to transfer values between activities.
The Android system provides four data storage methods. They are SharePreference, SQLite, Content Provider, and File. In Android, data is basically private and stored in the "data/package name" directory. Therefore, to share data, use Content Provider. SQLite: SQLite is a lightweight database that supports basic SQL syntax and is a common data
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.