0% found this document useful (0 votes)
55 views3 pages

Lab 01A

The document provides instructions for students to build a simple Android calculator app. It outlines creating a new project, designing the user interface with input fields and buttons, adding code to perform calculations on button click, and testing the completed app.

Uploaded by

Akiba秋葉
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views3 pages

Lab 01A

The document provides instructions for students to build a simple Android calculator app. It outlines creating a new project, designing the user interface with input fields and buttons, adding code to perform calculations on button click, and testing the completed app.

Uploaded by

Akiba秋葉
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

HONG KONG INSTITUTE OF VOCATIONAL EDUCATION (TUEN MUN)

DEPARTMENT OF INFORMATION TECHNOLOGY

ITP4210 Open Source Mobile Applications Development


Lab01A - Calculator

In this lab, you are going to implement a simple Android


calculator application. The user interface consists of two input
fields and a button. The expected user interface is shown on the
figure in the right. Users can input two numbers to the input fields
and then click the “ADD” button, the system will add two
inputted number together and pop a notification to display the
result. The result will also show below the “ADD” button. Please
follow the following steps to complete this lab.

Step 1 – Create a new Android Project


 Create a new Android Project and change the name to
YourName_Lab01A, select Empty Activity and change the
Minimum SDK to API 21: Android 5.0

Step 2 – Create the user interface


 In activity_main.xml, please place following items to the
corresponding position, you have to add the LinearLayout
first before adding the items:
1. Plain Text (id: input1, text: -)
2. Plain Text (id: input2, text: -)
3. TextView (id: textView_num1, text: Num1:)
4. TextView (id: textView_num2, text: Num2:)
5. TextView (id: result, text: Sum:)
6. Button (id: addbtn, text: ADD)
 Select three LinearLayout groups and change the layout_height to wrap_content
Step 3 – Coding
In MainActivity.java, please type the following code, you are required to fill in the blank:

Step 4 – Testing and File Submission


 Test your application on Emulator or your Android devices to see whether the application
works properly
 Please add three more buttons “Minus”, “Multiply”, “Division” and the corresponding
logic in MainActivity.java
 Please zip your Android Project File and submit to Moodle

You might also like