Android Learning notes (ii)

Source: Internet
Author: User

GetPath () of the file class in Java, GetAbsolutePath (), Getcanonicalpath () difference

GetPath () returns the path defined, that is, if the relative path is defined, the relative path is returned, and if the definition is an absolute path, the absolute path is returned.

GetAbsolutePath () returns the absolute path corresponding to the path defined, but does not process "." and ".." , the result equals the user dir+ GetPath ().

Getcanonicalpath () returns a normalized absolute path.

For example, if the path defined is: \\src\\test1.txt, the result returned by GetPath () is: \\src\\test1.txt,getabsolutepath () Returns a result of F:\eclipseworkspace\testejb\. The result returned by \src\test1.txt,getcanonicalpath () is F:\eclipseworkspace\testejb\src\test1.txt\.

Steps for Android to read and write files on SD card

1). Call Environment's Getexternalstoragestate () method to determine if the SD card is plugged into the phone, and the application has permission to read and write the SD card. For example, use the following code:

Environment.getexternalstoragestate (). Equals (environment.media_mounted)//If the return value is true, you have the ability to read and write the SD card.

2). Call Environment's getExternalStorageDirectory () method to get the external memory, the directory of the SD card.

3). Use FileInputStream, FileOutputStream, FileReader, or filewriter to read and write data from the SD card.

Where the path to the SD card is/mnt/sdcard/, because it is entirely possible to replace the result of step 2 with/mnt/sdcard/.

Androidsqlite Database

SQLite is an Android system integration of a lightweight database, essentially just an embedded database engine, specifically for resource-constrained devices on the right amount of data access. SQLite (Sqlitedatabase) is not the same as Oracle, MySQL database need to install, start the server process, SQLite database is just a file.

Android Screen coordinate system

The upper-left corner of the screen is the origin of the coordinate system (0, 0), and the origin extends to the right of the x-axis, and the origin is the positive direction of the y-axis.

Gestureoverlayview components

The Gestureoverlayview component is a specialized gesture editing component, which is like a drawing software, except that the user draws on the component is not a graphic, but a gesture. Because Gestureoverlayview is not a standard view component, it is required to use the fully qualified name Android.gesture.GestureOverlayView when using the component in the interface layout.

The Android:gesturestroketype property of the Gestureoverlayview component controls whether the gesture requires multiple finishes, a single value of single, and a value of multiple indicates that more than one pen is required to complete.

Android Learning Note (ii)

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.