Alibabacloud.com offers a wide variety of articles about storage emulated 0 android data, easily find your storage emulated 0 android data information here online.
The sharedpreferences provided by Android is similar to WindowsProgramCommon INI files are saved in the form of key-value (data type differentiation ). For example, it can be used to save the user's last login information, the volume setting of the Media Player and the last playback position.
Frequently used methods when using sharedpreferences include ):
Context. getsharedpreferences (string name
Most of the time, our software needs to store or re-access the processed data. Android provides the following methods for data storage:FileSharedpreferences (parameter)SQLite DatabaseContent Provider)Network
1. File
1.1 Use Files for data storage
Activity provides the openfi
Android data storage,
When the app is running, you need to save some user information. For example, the logon status and account information. Android provides multiple methods to store user data.
1. key-value storage, implemente
());Where the database path is required to pass in the database name, the return value is as follows:08-26 08:04:01.049:debug/temppjactivity (): cont.getcachedir () =/data/data/com.study/cache08-26 08:04:01.049:debug/temppjactivity: Cont.getdatabasepath ("temp") =/data/data/com.study/databases/temp08-26 08:04:01.099:d
In addition to the SQLite database, sharedpreferences is also a lightweight data storage method. In essence, sharedpreferences stores key-value pairs based on XML files and is usually used to store some simple configuration information. Its storage location is in the/data/
1. Get the sharedpreferences object based o
Sharedpreferences simple data storage, my understanding is similar to the Windows INI fileCan store many types, write a small exampleActivity_main.xmlLinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:id= "@+id/linearlayout1"Android:layout_width= "Match_parent"Android:layout_height= "Match
1. data file access operationWe can access the data to the default storage address for Android app data, with the address: installation package/data/data/1) Write
1. Data Persistence StorageAndroid offers 4 ways to store files: files (/data/data/),sharepreference(/data/data/ ),SQLite Database (/data/data/) and Content Provider.Android uses the "j
methods provided by Sharedpreferences.editor: We can see that the data types supported by Sharedpreferences are: boolean, float, int, long, string, string, type set.Simple Use Example:1 sharedpreferences preferences = getsharedpreferences ("Sharedname", mode_private); 2 sharedpreferences.editor Editor = preferences.edit (); 3 editor.putstring ("Key", "abc"); 4 editor.commit ();Note: The fourth line of code above is very important, without this code,
The Qiao woman is difficult to urge without rice, data is a program of flesh and blood, but where does Android data exist? Android provides four ways to store data: sqlite/contentprovider/file/sharedpreferencesBecause the basic operation of the
In Android, we can put some data directly in the form of a file to be present in the device. For example: Some text files, PDF files, audio and video files and pictures. Android provides a way to read and write files.The standard Java file input stream (FileInputStream) is obtained through the Context.openfileinput () method, and the standard Java file output str
Sharedpreferences is the easiest to understand in Android data storage technology, in fact Sharedpreferences is dealing with a key-value (key-value pairs). Sharedpreferences is often used to store some lightweight data.
Copy Code code as follows:
Instantiate the Sharedpreferences object (first step)
S
designing the java client program, we need to explicitly use the large-end byte order in the program to process int, short, long (strings do not need to be considered), that is, int, short, convert long to byte []. [Store the high positions of short and int in front of the character array
Surface] Of course, you can use a small byte to store the data. After receiving the data, the socket prints the
SQLite lightweight database is mainly used for embedded systems. It only occupies hundreds of K of system resources and has the following features: lightweight: you only need a dynamic library to enjoy all the functions, in addition, the dynamic library size is also very small and independent: the Core Engine does not need to rely on third-party software isolation: All database information (tables, views, triggers) is stored in the same file cross-platform: supports most operating systems, you c
[Java]Import java. util. List;Import java. util. Map;Import android. content. Context;Import android. content. SharedPreferences;/*** Tool for storing configuration information * Note: The data types that can be read include-*/Public class SharePreferenceUtil {Private final String MAK = "innoview ";Private final int MODE = Context. MODE_WORLD_READABLE + Context.
Pop Up ToastYou can get the control object first in OnCreateThe package name of the/data/data/program/file read/write under this directory may become unreliable due to changes in the package name.This can be an activity, or it can be a contextThis.getfiledir (); data/data/Package Name/filesFileSharedUse the API to dyna
Test. java:
/*** The problem solved in this example: * core problem: Create a database object through the SQLiteOpenHelper class * perform operations on the database data through the database object * 1. operate the SQLite database using SQL statements * 2. operations on SQLite databases using APIs provided by Google * 3. SQLite operations on Transactions */import com. ghsy. createsqlitedb. db. myOpenHelper; import
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.