Courses / Mobile Application Development (CDE-315) – BS CS 5th Semester
Assignment 2 (Weeks 5–8) – "Campus Hub": Fragments, Intents, Notifications and Menus
Week 8 – Action Bar and User Interface Design · 600 min read
Assignment 2 – "Campus Hub" App with Fragments, Intents, Notifications and Menus
Covers: Weeks 5–8 (fragments, intents and notifications, screen components and orientation, action bar and UI; Labs 5–8) CLOs: CLO-2 (develop apps), CLO-4 (use modern tools to solve problems) Type: Pairs allowed · Marks: 20 · Suggested due: end of Week 8 (before the mid-term)
Part A – Practical (15 marks)
Build Campus Hub, a single-activity app with a MaterialToolbar and a BottomNavigationView hosting three fragments:
| Fragment | Requirements |
|---|---|
| Contacts | List of at least 5 campus offices (e.g. Admissions, Exams, IT Help Desk) with buttons/rows to Call (ACTION_DIAL), Email (ACTION_SENDTO mailto:), Visit website (ACTION_VIEW https) and Show on map (geo: URI). Handle "no app found" gracefully. |
| Register | Event registration form – TextView labels, EditText (name, email, phone with correct inputType), RadioGroup (session: Morning/Evening), CheckBox (terms), Button. Validate input; on success show a summary and post a notification "Registration confirmed" (channel + POST_NOTIFICATIONS permission on Android 13+; tapping it opens the app with a PendingIntent). |
| Profile | Shows name and roll number received through fragment arguments; a Share button sends a text using ACTION_SEND with a chooser. |
Also:
- Options menu in the toolbar: Search (
ifRoom), About (dialog) and Exit (confirmation dialog) in the overflow; a context menu (long press) on a contact row with Copy number and Call. - Orientation: provide a
layout-landversion of the Register fragment (two columns) and make sure the summary text survives rotation (onSaveInstanceState or ViewModel). - The app must not crash when rotated on any screen.
Part B – Analytical questions (5 marks)
- Compare explicit, implicit and pending intents with one example of each from your app. (2)
- Explain what happens to a fragment's lifecycle when the user switches tabs using
replace(), and why you checkedsavedInstanceState == nullbefore adding the first fragment. (2) - Why did Microsoft's Windows Phone platform fail, and what lesson does it teach about choosing a development platform? (1)
Deliverables
Project zip/GitHub link, debug APK, a 1-minute screen recording (phone screen recorder) showing every feature including rotation and the notification, and a PDF with answers to Part B.
Rubric
| Criterion | Marks |
|---|---|
| Bottom navigation with 3 fragments, arguments | 3 |
| Implicit intents (call, email, web, map, share) with error handling | 3 |
| Registration form with validation and summary | 3 |
| Notification with channel, permission and PendingIntent | 2 |
| Options menu, dialogs and context menu | 2 |
| Landscape layout and state preserved on rotation | 2 |
| Part B answers | 5 |
Previous: Week 8 Lab 8 – Create a Simple Menu and Display Messages When Menu Items Are Selected · Next: Mid-Term Revision and Exam Guide (Weeks 1–8) + Lab Mid-Term
All lessons in Mobile Application Development (CDE-315) – BS CS 5th Semester