This is a tutorial for programmers who take you through the Android Development series. This article is dedicated to object-oriented programmers who can quickly learn to develop Android technology.
Previous post:. NET programmers quickly learn how Android development-layout and click events are written
It mainly explains the layout and the writing of click events.
The previous article added:
Control Unit Description:
px pixels
Dip or DP device independent pixels
SP proportional pixels
The height width of the control is typically dip or DP. Font with SP.
Android Storage Data item:
Description: Realize QQ login effect.
Enter your account password, and tick remember account number, click Login, save account information. The next login can directly display the last saved QQ account.
Front interface writing: (Of course, this is not the standard answer, everyone just put the layout of the cloth can be)
Process:
User click the login button
Background gets the status of the checkbox. If you do not check the operation.
If the checkbox is checked, then the value entered by the QQ account will be saved.
Open the app again, and the query stores the QQ account number. If available, it is displayed in the text box, otherwise it is not displayed.
Background handlers:
Java traditional notation, stored in a file.
After you install the app, the folder for the package name is automatically generated in the/data/data/directory. We are saving the data in the form of files to this directory.
We enter in the interface: Account name 123456 password 123456 hint:
At this point we find the saved file.
Click on the toolbar of Android Device Monitor
By following the path, export the file to your computer to display:
You'll also need to show your account password when you re-enter the app:
Write the following code in the OnCreate method: (That is, when initializing)
There are sometimes errors in the file's storage path, and the path is required whenever a file is involved in reading or writing. So Google programmers encapsulate a lot of ways to get the path directly to the application package.
These two APIs correspond to folders in.
Convenient for us to use.
Second, stored in the SDcard:
The special point of the SD card is that the status of the SDcard is indeterminate. Sometimes it can be used, sometimes it may be unplugged by the user. So we need to determine the status of the SD card. At one point is the SD card read and write requires certain permissions. The others are the same as above.
Judging status and common APIs:
Third, stored in the shareprefence:
Shareprefence: Save the data to use Shareprefence. is actually an XML config file. Usually only the current app has permission to read and write.
Write Shareprefences:
Read Shareprefences:
The next article explains the XML and SQLite operations.
If you feel the article can also, please click Subscribe to follow me.
Write code also to read, love the whole stack, more love life
Do the full stack siege lion
Can add groups to Exchange Learning: QQ Group number: 538742639
Programmer takes you to learn Android development series-android file storage