Dark Horse Android Notes

Source: Internet
Author: User

Next day

Textutils.isempty (Var) determines whether a certain amount of Var is empty

"Zhangtao". Equals (Var) determines whether Var equals zhangtao

The way to bring up DDMS in Android Studio is to press the small green robot on the toolbar to find the file Explorer

If you write file File = new file ("A.txt") in the program; This is to be created directly under the directory of the application, which is created unsuccessfully. The directory of the application under data/app/, this directory is not allowed to create files.

Each app creates a file for it under the/data/data/package name, which is the folder where the data is stored. For example, file File = new file ("/data/data/com.example.zhangtao/info.txt"); This is the way to be.

Context.getfilesdir (); Help us return the data/data/package name/files directory For example: File File = new file (Context.getfilesdir (), "context.txt");

Context.getcachedir (); Help us return to the data/data/package name/cache directory

Use the context to write files directly, can not context.getfilesdir (); The following code: (will be automatically saved in the data/data/package name/files directory)

FileOutputStream fos = context.openfileoutput ("Private.txt", context.mode_private);

Fos.write ("Aabb". GetBytes ());
Fos.close ();

Dark Horse Android Notes

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.