You are on page 1of 7

Official (Closed) - Non Sensitive

Page 1 of 7

Mobile Application Development Week 3 & 4


Diploma in CSF, DS, IT
4 hours
AY2023
Practical Exercises

NOTE: For all online practical, create all activity using the following package. The online
auto-checker is looking for a specific format.
Name: madpractical
Package: sg.edu.np.mad.madpractical

Click on this link to join week 3 practical,


https://classroom.github.com/a/jXypHc6I

1. Modify the onClickListener of left button to show a Toast message. The toast message will
show Followed if the user click on the Follow button, and vice versa.

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 2 of 7

2. Create a new Empty Views Activity with the following configuration,


Activity Name: ListActivity
Generate a Layout File: Checked
Layout Name: activity_list
Launcher Activity: Checked
Source Language: Java

3. In the activity_list layout file, create an ImageView, position it in the middle of the screen.

4. Create an onClickListener for the image created in previous step. Upon clicking the image,
an AlertDialog will appear as shown in the figure below.

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 3 of 7

5. Upon clicking the View button, a random integer will be generated. The MainActivity
(created in previous practical) will be launched, and the random integer is sent over.

6. Modify the MainActivity to display the random integer together with the name.

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 4 of 7

CHALLENGE

7. Create a new Empty Views Activity with the following configuration,


Activity Name: MessageGroup
Generate a Layout File: Checked
Layout Name: activity_message_group
Launcher Activity: Unchecked
Source Language: Java

8. Create an event listener for the Message button. Upon clicking on the button, the Activity
created in previous step, MessageGroup, will be launched.

9. Modify the layout of MessageGroup as shown in the image below.

Buttons

FrameLayout

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 5 of 7

10. Fragments are commonly used in Android applications. They are an extension to Activities.
Research and discover how to implement loading of fragment within an activity.
Implement MessageGroup as illustrated in the image below.

https://guides.codepath.com/android/creating-and-using-fragments#embedding-a-
fragment-in-an-activity

Clicking on Group 2
Clicking on Group 1

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 6 of 7

Click on this link to join week 4 practical,


https://classroom.github.com/a/6M4EIOtf

1. Create a List of 20 User objects in the ListActivity. Randomize the name, descriptions and
value of Followed.

2. Replace the ImageView in the ListActivity with a RecyclerView. Populate the


RecyclerView with the list created in previous step.

3. Add an onClickListener for the image such that it will show an Alert Dialog with the
corresponding name. Clicking on the view button will direct the user to the MainActivity
to show the profile page. Toggling the Follow button should save the state back in the
respective User object.

Hint: You can use static variable.


Using global static variable is not a good software engineering practice. Are you able to
figure other ways of achieving these behaviours?

MAD AY23 Sem 1 Update on: 9 April 2023


Official (Closed) - Non Sensitive

Page 7 of 7

4. Modify the RecyclerView such that if the last digit of the name contains 7, a different
layout is used as shown below. This new layout will have an additional ImageView that
occupies the width of the screen and has a width-to-height ratio of 1:1.

MAD AY23 Sem 1 Update on: 9 April 2023

You might also like