202100240_ICT361_LAB1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

MULUNGUSHI UNIVERSITY

SCHOOL OF ENGINERRING AND TECHNOLOGY


Department of Computer Science and IT

➢ Name: Mazuba Hamuchenje


➢ Student ID: 202100240
➢ Programme: Bachelor of Science in Computer Science
➢ Course Code: ICT 361
➢ Course Name: Mobile Application Programming
➢ Lab Number: one (1)
➢ Lecturer:
➢ Due Date: November 9, 2023
Contents
AIM ......................................................................................................................................................... 3
OBJECTIVES ......................................................................................................................................... 3
INTRODUCTION .................................................................................................................................. 3
QUESTIONS 1 ....................................................................................................................................... 4
DISCUSSION ..................................................................................................................................... 4
PSUEDOCODE .................................................................................................................................. 4
FLOWCHART .................................................................................................................................... 4
TESTING ............................................................................................................................................ 5
QUESTION 2.......................................................................................................................................... 7
DISCUSSION ..................................................................................................................................... 7
PSUEDOCODE .................................................................................................................................. 7
FLOWCHART .................................................................................................................................... 7
TESTING ............................................................................................................................................ 8
CONCLUSION ..................................................................................................................................... 14
REFERENCES ..................................................................................................................................... 14

Figure 1. Shows the textView widget "I am poor" and an imageview widget which is the coal image . 6
Figure 2. shows an image before the user clicks the ask button .......................................................... 10
Figure 3. shows the image after the user clicks the ask button and it provides the decision .............. 12
Figure 4, shows an image after the user clicks the add button and provides another decision .......... 14
AIM
• to reinforce programming concepts Java and also introduce students to XML.

OBJECTIVES
• Navigating and using Android studio to build simple mobile applications.
• Adding different design elements to your app
• Customising the look of an app by editing the properties/attributes of different
elements.
• Connecting the design layout to the logic and Java code

INTRODUCTION
Android is the most widely and commonly used mobile platform in the world, with
hundreds of millions of devices running it in more than 190 countries. It was first released
October 2008. The operating system for android was developed by Android, Inc. Then it east
elicited by google in July 2005. Android operating system is open source and free, the system
is based on a modified version of Linux kernel.
XML (Extensible Mark-up Language), it is a mark-up language like HTML, it is used
to implement the GUI (Graphical User Interface) in android to the related data. Most of its
syntax are similar to HTML and CSS, for instance, the simplest tag in XML is <tag
name>HELLO WORLD! </tag name> which is alike to HTML tag.
In Android, we can create deep links to app content. When a clicked link or
programmatic request invokes a web URI intent, the Android system tries each of the
following actions, in sequential order, until the request succeeds. We can add intent filters for
incoming links. To create a link to our app content, we add an intent filter that contains these
elements and attribute values in our manifest. We can also use the App Links Assistant in
Android Studio to add Android App Links.

QUESTIONS 1
DISCUSSION
We were told to write a simple application called “I am poor”, that displays some text and has
an image. Firstly, setup my android studio as the IDE for this application. Then download an image
and named it coal image, moved the image in drawable folder which is contained in the res folder. In
the activity_main_xml, used the constraint layout as the parent layout. In it we set a textView widget
to display a text in our application, set all the necessary attribute like height, width, size, colour and
alignment. The displayed text is “I am poor”. Beneath it we added another widget known as
imageView that displays our image coal. Which attributes like height, width and id.
Lastly, created a class in the java file called the MainActivity which inherits a method called
onCreate () from the AppCompatActivity. The setContentView (R. layout. activity_main) is a
method in Android that sets the layout for the current activity. This layout defines the user interface
for the activity. Meanwhile the R.layout.activity_main refers to a layout file called
activity_main.xml located in the res/layout directory in my Android projects. This file contains the
layout details for the MainActivty in my application.

PSUEDOCODE
Start
Define constraints layout in activity_main.xml
Create textview widget.
Add attributes or properties.
Create imageView widget.
Add attributes or properties.
Stop
FLOWCHART

Start

Define layout
Create TextView

Create ImageView

Stop

TESTING
Figure 1. Shows the textView widget "I am poor" and an imageview widget which is the coal image
QUESTION 2
DISCUSSION
Set up an image in ImageView widget and set the id property, then added the
button to the activity_main.xml file and set the text to ask. Create a class called image which
sets and gets instances of an image in java code. Then in the MainActivity.java. Defined and
initialized objects of ImageView and button, both are initialized to a method called
findViewById(R.id.image_eightBall), this method connects the java code to xml. Set
onClickListener with button object. Created objects of images to store images, then store
them in an array called imageArray. Then use the shuffle method to select images at random.
PSUEDOCODE

Start

Defined Linear layout.

Create a TextView widget

Add properties and attributes.

Create ImageView widget

Add properties and attributes.

Create button widget.

Add properties and attributes.

In java file

Initialise button and image object.

Set onClickListener to button.

Stop

FLOWCHART

Start

Define linear layout


Create textview
widget

Create imageview widget

Create button widget

Stop

TESTING
Figure 2. shows an image before the user clicks the ask button
Figure 3. shows the image after the user clicks the ask button and it provides the decision
Figure 4, shows an image after the user clicks the add button and provides another decision

CONCLUSION
Android is a popular and free open source operating system for mobile devices, based
on Linux kernel. It was developed by Android, Inc. and acquired by Google in 2005. XML
(Extensible Mark-up Language) is a mark-up language used to design the graphical user
interface (GUI) of Android apps. XML tags define the layout and appearance of different
elements on the screen. Android apps can also create deep links to app content by using intent
filters and web URI intents. These allow the app to respond to incoming links and requests
from other apps or browsers.

REFERENCES

You might also like