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.
Android -- Listview does not use the yydatasetchanged method to update data. androidlistview updates data.
I. IntroductionThe following describes how to update data in listview:1. listview. setadapter () is called each time data is updated ();2. Call adapter. notifydatasetch
Android System integrates a lightweight database:SQLite, so Android support for the database is very good, each application can easily use it. As an embedded database engine, SQLite is dedicated to the right amount of data access on devices with limited resources, and now mainstream mobile devices like Android, iphone
static final String KEY = "My_backup"; @Override public void OnCreate () {//constructs a file read-write object, declares the file that needs to be backed up filebackuphelper helper = new Filebackuphelper (th IS, "Backup_file"); Addhelper (Key,helper); Super.oncreate (); } @Override public void Onbackup (Parcelfiledescriptor oldstate, backupdataoutput data, Parcelfiledesc Riptor newstate) throws IOException {//Call the parent clas
). show ();The running result is as follows. We can see that we pass data from one Activity to another.
Of course, other basic data types, such as Double int, can also be passed as long as they are changed when receiving the data, such as receiving the double type
Double x=bundle.getDouble(key);
Code Attached
MainActivity
Package com. example. activity; import
Previously introduced three kinds of data storage forms of Android system, http://www.jb51.net/article/99468.htm. Today, there are two other types of content providers and networked storage, respectively. Some people may think that the memory provider and networked storage are more inclined to manipulate the data than the dat
Click Save and save the created file in/data/Directory, you can check: ddms -- file Explorer -- Data --
Select a file and click it to export the file for viewing. Click it to add other files.
After you click "save", the prompt box is displayed, indicating that the file is saved successfully. After you click "read", the prompt box displays file content: ×××××.
Layout File
Activity_main.xml
Business Layer
Mdata will be in the text box changes, The Mdata data will be changed accordingly, which is what the update operation needs to do. Here is the creation of the metadata set,
The code is as follows:
ListView Mlistview;
Arraylist
And then use Mdata to create adapter
private void Set_mlistview_adapter ()
{
Mlistview = (ListView) Findviewbyid (R.id.mlistview);
Getmdata (mdata);
adapter = new Simpleadapter (this,mdata,
In Android development, it is often necessary to use data paging, such as to achieve a news list display, or the list of posts can not be displayed in the first load, it is necessary to use a paging method to load data, in Android handler is often used in time-consuming work, It receives the
When the Android animation-like Meituan loads data and waits, the Progress animation dialog box (with SF courier running effect) and android progressThe first sentence is still the old one, you know! Finddreams :( http://blog.csdn.net/finddreams/article/details/43194799 ). We all know that there are two common Animation modes in
Android offers the following four ways to store :
Sharepreference
Sqlite
File
ContentProvider
The data in the Android system are basically private, and are generally stored in the "data/data/package name" directory. If you want to implement
. content. Context;
04 import android. database. sqlite. SQLiteDatabase;
05 import android. database. sqlite. SQLiteOpenHelper;
06
07 public class MyOpenHleper extends SQLiteOpenHelper {
08
09 public static final int VERSION = 1;
10
11 public MyOpenHleper (Context context, String name ){
12 super (context, name, null, VERSION );
13 // TODO Auto-generated construc
[Development Diary of Android in a row from scratch] (12)-data transmission between Android Components
We have components, so we lack a channel to transmit information between components. Using Intent as a carrier is a king of practices. In addition, the file system can be used for data sharing. You can also use the Ap
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.