Android SQLite development tutorial (1): overview

Source: Internet
Author: User

SQLite is an open source database management system in an embedded system. It supports standard relational database query statement SQL syntax and Transaction (Transaction ), the default statement (similar to the stored proc of other DBMS ). On the Andrioid platform, only KB of memory is required.

On the Android platform, no Database settings and management are required. You only need to use SQL statements to access the Database. SQL automatically manages the Database for you.

Using a database on the Android platform may be slow, because a large number of read/write operations (typically on the SD card) are involved in accessing the database ). Therefore, we recommend that you do not use the UI thread to access the database. You can use AsyncTask to read and write the database.

SQLite supports the following data types: TEXT (similar to the String type in Java), INTEGER (similar to the long type in Java), and REAL (similar to the double type in Java ), all other data types must be converted to one of the three types before they can be stored in the database.

It should be noted that SQLite does not verify the data type of the field, that is, you can write the integer to the string field.

If your application creates an SQLite database, its default path is "DATA/data/APP_NAME/databases/FILENAME ".

DATA is the path returned by using Environment. getDataDirectory (), which is generally the path of your SD card.
APP_Name is your application name
FILENAME is the name of your database.
Generally, the database created by an application can only be accessed by the application that creates it. To share your data, you can use Content provider.

 

 

Excerpted from the mobile app

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.