博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
COMP 208, Assignment
阅读量:5234 次
发布时间:2019-06-14

本文共 4712 字,大约阅读时间需要 15 分钟。

COMP 208, Assignment 1
Milestone 1
Outline
Create an Android application that manages contacts using an SQLite database. The application should allow the user to add new contacts, list all contacts, and display contact details.
Step 1 (Contacts Model)
1.Create a new Android application project.
2.Create a Contact class that stores the following information:
a.Contact id,
b.First and last name,
c.Phone,
d.Email,
e.Contact Type (friend, family, business, etc.)
3.Create a hardcoded array of Contact objects. Initialize the Contact objects with sample data.
4.Create a layout that displays the information stored in a single Contact object. Make use of style classes and string resources in your layout. (Note: issues icon in the Design Editor should indicate no
5.Add a MatrixCursor with columns that correspond to the fields in the Contact class. Populate the matrix cursor with the data stored in the contacts array.
6.Add First, Last, Prev, and Next buttons to the layout. Add click handlers to the buttons to allow the user to display contact information by navigating through the data held by the matrix cursor.
Step 2 (SQLite Database)
1.Create a DBContract class that defines the structure of a contacts database that contains a contact table. The columns of the table should match the fields of the Contact class.
2.Create a DBHelper class that defines methods to create the contacts database, insert records into the contact table, and select records from the contact table. (Update and delete methods are not required for this milestone.)
3.Add code to populate the contact table with the data held by the matrix cursor created in Milestone 1.
4.Modify the code in the click handlers so that they obtain contact data by querying the contacts database.
5.Document your code (using JavaDoc comments and annotations).
6.Test your application.
Hand In
At the end of the lab, zip your entire project into a file named YourLastName.zip. Copy the zip file to the drop box folder named COMP 208 A1 M1. (Hand in your project even if you have not finished this milestone.)
References:
All parts of this assignment have been covered in class or in previous labs.
A sample database project (DBDemo2) is available in the COMP 208 academic share folder. (Note: you may not be able to build and run this project without significant downloads to the ADK. Use this project as a code reference only.)
You may also have to use JavaDoc documentation for some of the classes (e.g. MatrixCursor).

Milestone 2
Outline
Add a 2nd Activity to the Contacts application. The layout for this activity should include a ListView that displays a scrolling list of the names of the contacts stored in the contacts database. When the user clicks on a contact name the contact details are displayed.

Step 3 (Create New Activity and Layout)

1.Create a new Activity by right clicking on the java node (in the Projects window), select Activity, then select Empty Activity.
2.In the Configure Activity dialog, set the Activity name to ContactListActivity, set the layout file name to contactlist_layout, and check the Launcher Activity checkbox. Finish.
3.Refactor the MainActivity name to ContactDetailsActivity.
4.Open the AndroidManifest.xml file and verify that the activity node named ContactListActivity includes an intent-filter node that sets the intent action to LAUNCHER. Since this activity will now become the new main activity, remove the corresponding intent filter from the .ContactDetailsActivity node.
5.Open the contactlist_layout and add a ListView to the layout. Add a Details button below the ListView.
(ListView is found under the Legacy section of the Palette window.) Set the constraints of the list view so that it fills the screen.

Step 4 (Display List of Contact Names)

Follow the code from previous labs to add code to connect the list view to the contact data in the database.
1.Add a click hander to the Details button to navigate to the contact details page.
2.Define a layout with components that will display a single contact’s name and phone number.
3.In the DBHelper class, add a function that queries the contacts database and returns the contact id, first name and last name for all contacts.
4.Note: you will have to call getReadableDatabase() rather than getWritableDatabase().
5.Create a SimpleCursorAdapter that connects the data returned from the query to the ListView.

Hand In

At the end of the lab, zip your entire project into a file named YourLastName.zip. Copy the zip file to the drop box folder named COMP 208 A1 M2. (Hand in your project even if you have not finished this milestone.)

 

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱: 

微信:codinghelp

转载于:https://www.cnblogs.com/whattheyou/p/10420260.html

你可能感兴趣的文章
error_page 改变状态码为新的状态码,并显示指定内容
查看>>
win10 启动超级用户Administrator方法
查看>>
spark-2.2.2-bin-hadoop2.7 安装
查看>>
实验吧web-易-拐弯抹角(url伪静态)
查看>>
select 的选中问题
查看>>
java Pattern类
查看>>
基本算法-0/1背包问题
查看>>
广商14级软件工程团队第二次冲刺相关问题
查看>>
测试经理/组长职责
查看>>
cocos2d-x中描述精灵帧图片的plist和json文件各个key的含义
查看>>
Java垃圾回收机制
查看>>
排球比赛规则
查看>>
远程WebService方法
查看>>
【转】HashMap 和 HashTable 到底哪不同 ?
查看>>
软件工程课程-课程作业安排
查看>>
第三次作业
查看>>
loadxml Data at the root level is invalid. Line 1, position 1.
查看>>
springMVC-自定义数据类型转换器
查看>>
使用 VS2015 编译并调试 ffmpeg
查看>>
正则匹配原理之——逆序环视深入
查看>>