Android
External Storage stores store data files on the SD card.
1. When saving data, you must first judge the SD card status.
Environment. getExternalStorageState () can be used to display the running status of the SD card.
There are two statuses:
MEDIA_UNKNOWN,MEDIA_REMOVED,MEDIA_UNMOUNTED,MEDIA_CHECKING,MEDIA_NOFS,MEDIA_MOUNTED,MEDIA_MOUNTED_READ_ONLY,MEDIA_SHARED,MEDIA_BAD_REMOVAL, OrMEDIA_UNMOUNTABLE.
Last time, I was initially exposed to the mounting problem of Android USB client, so I wrote the first article about the feelings. There are still some problems in many places, some of which are not clear enough, so I want to continue writing.
First, the last verification shows that the device can be mounted, but only one storage device can be mounted at a time.
Secondly, what I said last time about the dri
As a complete application, data storage operations are essential. Therefore, 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 P
As a completed applicationProgram, Data storage operations are essential. Therefore, 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/data/package name" directory. Therefore, to share data,
Android provides four data storage methods. However, because the stored data is private to its applications, if you need to use the data in other applications, you must use the content provider (Data Sharing) provided by Android ).
The official documentation has a detailed description: http://developer.android.com/guide/topics/data/data-storage.html
The four data
Learn android from scratch (Data Storage (2) Internal Storage. 36 .)
CallopenFileOutput()With the name of the file and the operating mode. This returnsFileOutputStream. PassOpenFileOutput () creates a FileoutputStream object
Write to the filewrite(). Create a Write object and perform data read/Write operations.
Close the streamclose(). Close the link.The abov
Getting started with Android (9) file storage and SharedPreferences storage,
Link: http://www.orlion.ga/578/
The Android system provides three methods for simple data persistence, namely file storage, SharedPreference storage, and
Android notes-data storage in Android (3), android notes
The Android system integrates a lightweight database:SQLiteTherefore, Android supports databases very well and every application can use it conveniently. As an embedded data
troublesome.But Google has provided us with a dedicated access to internal storage api:getfilesdir () Create a file where the user saves the user name and password //file file = new file ("Data/data/com.demo.storage/info.txt"); Getfilesdir returns a file object whose path is: data/data/com.demo.storage/files File File = new file (Getfilesdir (), "Info.txt") ;The path to the Getfiledir is under the files file under the package name: Wh
This article translated from: http://developer.android.com/guide/topics/data/data-storage.html
Android provides several optional solutions for persistent data storage. The specific solution depends on your specific needs, such as whether the data is private to your application or accessible to other applications (and users, and the space required by the data.
The following are available
Original link: http://www.orlion.ga/578/The Android system offers three ways to simply implement data persistence, namely file storage, Sharedpreference storage, and database storage. Of course, in addition to these three ways, you can also save the data in the phone's SD card, but the use of files, sharedpreference or
The previous section learned how to read and write files in the phone's internal storage, and this section learns how to read and write files in the phone's external storage. That's how to read and write files in SDcard.We also use the previous login interface example to illustrate, (login interface please see the android sto
the mobile phone space, the general phone storage space is not very large, storage of small files is OK, if you want to store large files such as video, it is not feasible. For large files like video, we can store it in SDcard. What is sdcard for? You can think of it as a removable hard drive or USB stick.To use SDcard in the simulator, you need to first create a SDcard card (not really sdcard, just the im
Android-storage of configuration files SharedPreferences for data storageMost of the time, the software we develop needs to provide users with the software parameter setting function, such as our commonly used QQ, users can set whether to allow strangers to add themselves as friends. For saving software configuration parameters, if the window software is used, we usually use the INI file for saving. If it i
simple demo adds the company attribute to the contact person to save the JS code:[JavaScript]View Plaincopy
Save data
function Save () {
var contact = new Object;
Contact.user_name = document.getElementById ("user_name"). Value;
Contact.mobilephone = document.getElementById ("Mobilephone"). Value;
Contact.company = document.getElementById ("Company"). Value;
var str = json.stringify (contact);
Localstorage.setitem (CONTACT.MOBILEPHONE,STR);
Loadall ();
}
Extracts al
Android storage learning: Reading and Writing files in External Storage
This section describes how to read and write files in the internal storage of a mobile phone. That is how to read and write files in Sdcard.
The previous logon interface is used as an example to illustrate how to read and write files in the interna
I. Basic outline1. Description:1> the data files used to run the application can be saved to the SD card2> file Type: arbitrary3> Data Save path:Path 1:/storage/sdcard/android/data/packagename/files Other apps can access, remove when applying uninstallPath 2:/storage/sdcard/xxx/(indicates that the file you created--xxx) can be accessed by other apps and will not
The Android system provides a system-level Configuration Storage scheme for applications, which is implemented by the Sharedpreferences interface, where all the information stored in the interface is saved in the form of a name-value pair, but its data types are limited to basic data types such as strings, shapes, booleans, and so on. These configurations are eventually saved in an XML file, and each time t
Android-file storage-text Storage
[Return directory]
If you want to perform file input or output operations, you need to perform stream operations.
Activity Support for file operations
Public FileInputStream openFileInput (String name)Set the file input stream to open
Public FileOutputStream openFileOutput (String name, int mode)Set the output stream of the file
Download source code (download-free credits): Download
You can directly store data in internal storage. By default, files are private to internal storage and cannot beWhen you uninstall an application, the files are removed.You can create and write data in two ways:
Using related methods in java,
Use the related methods in android. content,
Call openFile
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.