Data storage and access, permissions under Android

Source: Internet
Author: User


Pop Up Toast



You can get the control object first in OnCreate



The 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 context

This.getfiledir (); data/data/Package Name/files


File


Shared


Use the API to dynamically acquire SD cards, and to determine if there is an SD card


The "mounted" status is found.


File sccardfile = Environment.getexternalstoragedirectory ();


Read and write SD card requires permission,


Get the remaining free space on the SD card





Get Cache Directory



Android Read and Write permissions issues


/data/data/Package Name/files/aaa.txt

Openfileoutput ("Aaa.txt", Context.)


Permission-related

1. Private files

2. Writable files

3. Readable files

4. Readable and writable files




Read other people's things can not be dynamically acquired, Roar




Sharedperference: Where to store it:


XML serialization and parsing

POM: A little analysis, can stop, use more

Dom: Read all to Memory

Sax: A little parsing, can't stop




Generating an XML file using the Pull parser




Write XML to Local




Parsing from native XML





Data storage and access, permissions under Android

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.