Experiment 8 SQLite Database operations
Purpose
Design a Personal Address book, master the development of the database under the Android platform, the personal Address Book mainly includes the contact list and contact details and other interfaces.
Requirements
The main interface of the program is the directory of contacts that displays the name of the contact on the phone. Click the contact's name to display the contact's details. The menu bar pops up after you press the MEMU key. Click the button on the menu bar to add contacts and delete contacts
Process
(1) Determine the data structure of the database. This procedure as long as a table, the contents and description of the table as shown in the table below
Field name |
Data type |
Description |
Field name |
Data type |
Statement |
_id |
Integer |
The number of the inserted record |
Name |
varchar |
Contact Name |
Phone |
Varchar |
Contact person's landline phone |
Mobile |
varchar |
Mobile phone number |
Email |
Varchar |
Address of the contact's mailbox |
Post |
varchar |
Contact fixed |
Addr |
varchar |
Contact the address of the recognized |
Comp |
varchar |
Contact location |
(2) The icon to be used to copy the program into the RES/DRAWABLE-MDPI directory
1) New Project
2) Modify the layout file Activity_main.xml
(3) Define string resource String.xml
(4) Development layout file Activity_main.xml is used to display the contact list.
(5) Create a new detail.xml in the layout directory to display the contact details, the code reference is as follows:
(3) Develop database auxiliary class Myopenhelper class, create a new Myopenhelper.java. The framework code is as follows
(4) The next step into the development of the mainactivity end, to achieve database additions, deletions, change records and other operations
(5) Create a new activity named Detailactivity.java, which realizes the contact details display function.
The "Expand Experiment" enables you to search contacts records by name or by phone.
Lab Report Requirements
1) write down the steps and contents of the experiment in detail;
2) detailed record of the problems found during the experiment and the method of solving the problem;
3) give the various pages in the process of running the program;
4) Submit documents include: Experimental report, source code, can run the installation program, all files packaging compression;
5) compression Package naming format: Professional + study number + name + experiment 8.rar
"Android" Experiment 8 SQLite database Operation 2016.5.13