In Android, parcel is used to bind containers that store basic data types and reference data types through ibinder. This method enables data to be transmitted between processes, parcel positioning is a lightweight and efficient object serialization and deserialization mechanism.
The Framework has the parcel class. The source code path is:
Frameworks/base/CORE/Java/Andro
and delete files in the SD card--permission to write data to the SD card-- The steps to read the files on the SD card are as follows:1. Call environment 's getexternalstoragestate () method to determine if the phone has an SD card, Whether the application has permission to read and write to the SD card, such as environment.getexternalstoragestate (environment.media_mounted) . 2. Call environment 's getexternalstoragedirectory () method to get the SD Card's directory. 3. Use fileinputstrea
The seventh session describes the internal storage of read-write files click the Open link.This has a comparison of the problem, assuming that the system memory is not enough, kill the application can not be executed, or the application was uninstalled by the user after reinstallation. Previously saved usernames and passwords are not echoed. Therefore, it is necessary to pay attention to this problemSo save
());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:debug/temppjactivity (): cont.getfilesdir () =/data/data/com.study/filesIn addition, you can get the
flags, java. Lang. String installerpackagename)
4. Third-party application installation-install the SDK through the APK file in the SD card
Save the APK installation package to the SD card, access the APK installation package in the SD card from your mobile phone, and click it to start the installation interface.Packageinstalleractivity parses the package and determines whether the APK file is available.
Create a temporary installation file/data/COM. Andro
Android-4.2-3g migration path APN (5)
APN, this is not so easy to understand for people who are new to us. It is essential for 3G Internet transplantation. Record it here.
Concept:
The Access Point Name (APN) is the Access Point. A parameter that must be configured for a mobile device to Access the Internet using data traffic. This parameter indicates how to connect to the service center to enable the data
Android sdcard path access methods: androidsdcard
In previous Android (versions earlier than Android 4.1), the SDcard path is represented by "/sdcard" or "/mnt/sdcard", while in JellyBean (Android 4.1) the system changes to "/
()///folder directory for all files for (int i = 0; i 5)Use this method to prevent multiple pop-up reminders when a toast is triggered multiple timesPrivate Toast mtoast = null;private void Showtoast (context context, String str) {if (mtoast = = null) {Mtoast = Toast.maket EXT (context, str, toast.length_short);} else {mtoast.settext (str);} Mtoast.show ();}File related actions:1) String name = File.getname ();// get the file or folder names:2) File.mkdir (); Create a folder3) File.createnewfil
How to create folders and modify permissions in Android
Each application package has a private data storage directory. Only the application that belongs to this package has the permission to write data to this directory. Its absolute path: /data/
// Create a folder
File destdir = new file ("/data/
If (! Destdir. exists ()){Destdir. mkdirs ();}
// Modify permissi
context.mode_world_append
Read
Write
sharedpreferences The interface itself does not provide the ability to write data, but through its internal interface. It calls the Sharedpreferences.edit () method to get the Sharedpreferences.editor object it corresponds to. The editor has the following methods for writing data to Sharedpreferences:
Empty all the data in the sharedpreferences. E
Android local storage solution SharedPreferencesOriginal article addressStorage location
The SharedPreferences data is stored in:/Data/
/Shared_prefs
Directory, saved in XML format, the root element is:. The file name is the parameter value passed when obtaining the SharedPreferences instance.
value
Get instance
SharePerferences is an interface. Context implement
parameter is the key name to read, the second parameter is the default initial value. That is, the initial schedule defaults to 0 player.start (); }}Note Registering in the Androidmanifest.xml fileHere is the Mainactivity.java main interface file:public class Mainactivity extends Activity implements onclicklistener{private button B1;private button b2;private Intent i ntent; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layo
new context.mode_world_append
Read
Infer whether sharedpreferences includes data for a specific key. Boolean contains (String key)//gets all the Key-value pairs in the sharedpreferences. Map
Write
sharedpreferences The interface itself does not provide the ability to write data, but through its internal interface. Its invocation of the Sharedpreferences.edit () method allows it to obtain the corres
First, we will introduce how to store data using files. Activity provides the openFileOutput () method that can be used to output data to files, the specific implementation process is the same as saving data to a file in the J2SE environment.// The path of the written file is data/cn. csdn/files/file.txt.FileOutputStream fos = openFileOutput ("file.txt", Activity. MODE_PRIVATE );String content = "file storage
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 "java.io.*" library to provide an input-output (I/O) interface, where all files are read/written in stream form.2. File storageUnder the context class, there is openfileoutput(string name,int mode),openfileinput(string name)method to write or read a file. Name indicates the name of the file, not including the
[Phonegap + Sencha Touch] mobile development 29 Android navigator. camera. getPicture gets the true path of the image,
The phonegap photo plug-in selects the image in the Image Library. The Code is as follows:
Navigator. camera. getPicture (function (uri) {console. log (uri); // uri of the image obtained here}, function (err) {console. log (err) ;},{ quality: 70, destinationType: navigator. camera. destina
// Obtain the dictionary. absolute path of the DB file
Android supports four data storage methods:Preference, file, database, content provider. A test program that has been working over the past few days requires the storage of an image file. With this method, I have a little bit of experience.
First, preference, file
Environment Common methods:* Method: Getdatadirectory ()Explanation: Return File to get the Android data directory.* Method: Getdownloadcachedirectory ()Explanation: Return File to get the Android download/cache content directory.* Method: getExternalStorageDirectory ()Explanation: Return File, Get External storage directory is SDcard* Method: Getexternalstoragep
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.