In the last two sections we are using text files to save the user's information, which is obviously a loophole. At the same time, the content of the file is not managed. Today we learn to save with Sharedpreference. Sharedpreference is dedicated to preserving some of the more fragmented data.We still use the example of the previous section to analyze the user's information using Sharedpreference to save.Note: If you do not know what the example is, see Andro
Contentprovider introduction and Benefits
Introduction:
The role of contentprovider in Android is to share data externally, that is, you can share the data in the application to other applications through contentprovider for access. Other applications can use contentprovider to add, delete, modify, and query data in your application. For data sharing, we have learned the file operation mode before. We know that the operation mode of a specified file i
J2SE environment. The first parameter of the eg://Openfileoutput () method is used to specify the file name and cannot include the path delimiter "/", assuming the file does not exist. Android will voluntarily create//store path:/data/data/package name/files/jxn.txtfileoutputstream OutStream = Context.openfileoutput ("Jxn.txt", Context.mode_private); Sharedpref
Android player path: java-layer Binder and Android binder
Many people refer to the proxy mode when talking about Binder. There are a lot of people, and there is little understanding of the essence. This article analyzes the design objectives, design ideas, and design defects of the java-layer BInder from the perspective of design, so as to control it.
For [bond],
SD card path problems and how to get sdcard memoryYesterday, after studying the problems of breakthrough storage paths after taking photos, I started to write the storage paths as follows: private string folder = "/sdcard/dcim/camera, different cameras may cause problems in the path. A better way is to use environment
Dcard path problems and how to get sdcard memoryYesterday, after studying the problems of breakthrough storage paths after taking photos, I started to write the storage paths as follows: private string folder = "/sdcard/dcim/camera, different cameras may cause problems in the path. A better way is to use environment to
1 PrefaceStorage features of android devices:Memory and SD card storage devices, and the storage space of android devices is small, and the system is fragmented.SD card: the android device of the old version does not have a built-in SDThe new version of
The example in this article describes how Android uses files for data storage. Share to everyone for your reference. Specifically as follows:
Many times we develop software that needs to store the processed data for a second visit . Android provides the following ways for data storage:
File
Sharedpreferences (Parame
The most complex graphics in Android are made by path, such as drawing a curve and then moving an object along with the curve, such as a search button, such as a simple clock implementation:
So what is path!
Definition: path is the way, which is the set of paths of the graph, which contains the coordinates of the
Sharedpreferences is also a lightweight data storage method. It 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/
Common attributes and methods of sharedpreferences
Method Name
Description
Public Abstract Boolean contains (string key)
Determine whether sharedpreferences contains data of
Course Objectives:Several ways to master data storage in AndroidProficient in using Preferenceactivitypreferencescreen to do professional setting functionProficient in using SQLite3 to store dataIn-depth study of SQLite3 database features, and compared to large databases including stored procedures, the main foreign key association and other characteristicsLearn about the internal and external
)
The files generated by the app will be stored in this path
All four components of Android need to be configured in the manifest file before use
Application configuration is effective for the entire application
The activity's configuration takes effect on the activity
DDMS
Dalvik Debug Monitor Service
Dalvik Commissioning Monitoring Service
Commonly used ADB c
Andorid provides a variety of ways to store data, such as the "SQLite operation of the Android data store", as mentioned earlier, for more complex data storage. However, there are some simple data stores that can be cumbersome if they are used in a sqlite fashion. For example, it would be unnecessary and time-consuming to record whether a user has accessed data such as the Welcome page of the app, if using
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/data/package name" directory. Therefore, to share data, use cont
encapsulates APIs for database operations. This class can be used to create, query, and update data) and delete operations (crud ).
Content ProviderContent Provider is a bridge between data storage and retrieval among all applications. Its function is to share data among various applications. Android provides contentprovider (including audio, video, image, and address book) for common data)
Each content
SOURCE Blog: http://www.devahead.com/blog/2012/01/saving-the-android-webview-cache-on-the-sd-card/The main idea is to indirectly change the results obtained by WebView acquiring the cache directory by the override Getcachedir () method at the activity level;Getcachedir () and Getfilesdir () are often used when saving the cache (file), which returns the default result as/data/data/package name/cache (files).However, this can be very
I. Data storage File:
In android, you can create a file to save data on the storage device of the device or an external storage device. By default, files cannot be shared among different programs.
Context in android provides several methods for file operations.
1). openFileO
What file storage technology does the Android SDK support?Sharedpreferences, stream file storage, XML semi-structured storage, JSON storage, database, third aspect to the object database.How do I access key-value type of data using Shardpreferences?Instantiate the Sharedpref
) {Editor.putlong (key, (Long) value); } editor.commit (); } Public StaticObject Getsharedpreferences (context context, string key, Object defvalue) {String type=Defvalue.getclass (). Getsimplename (); Sharedpreferences sharedpreferences=preferencemanager.getdefaultsharedpreferences (context); //Defvalue is the default value and returns it if the data is not currently available if("Integer". Equals (Type) { returnSharedpreferences.getint (Key, (Integer) defvalue);
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.