Exercise one: SQLite basic operations

Source: Internet
Author: User
Tags sqlite

First, the basic knowledge:

Application Scenarios:

1> application operation needs to save a series of data with a certain structure (text can be but storage efficiency is low)

2> file type:. db (a database is a. db file)

3> Path:/data/data/projectpackage/databases/xxx.db

4> default other apps cannot access

5> data is deleted when the app is uninstalled

Sqlite:

A lightweight relational database server with small installation files (hundreds of k, embedded in Android), multi-os support, multi-lingual support, and fast processing speed.

Second, Android unit test:

1. Test class inheritance Androidtestcase

2. <!--using the Android Test pack application---
<uses-library android:name= "Android.test.runner"/>

3, <!--targetpackage value is consistent with the profile package value application
<instrumentation android:name= "Android.test.InstrumentationTestRunner"
Android:targetpackage= "Com.example.testsqlite"/>

Three, practical listactivity optimization function:

1. Inheriting listactivity

2. The ID of <ListView> in the layout file must be a system-defined Id:list

3, if you want to display a hint text when there is no data, you can define a <TextView> in the layout file (id must be empty);

Iv. Exercises:

1. Content

Use Sqliteopenhelper, sqlitedatabase, cursor to operate the database;

Use Listview+baseadapter to display the list;

Use ContextMenu;

Use Listactivity.

2, a function of the work:

Memory Operations: Collections/Objects

Storage operations: Database/File SP

Interface actions: List ....

Exercise one: SQLite basic operations

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.