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