Docsity

android mobile development notes, Summaries of Mobile Computing

Partial preview of the text

Download android mobile development notes and more Summaries Mobile Computing in PDF only on Docsity!

MOBILE APPLICATION DEVELOPMENT

Lecture Notes: Mobile Computing, Android, and UI/UX

Design

Beginner-friendly classroom notes with Kotlin and XML mini examples

Unit Coverage Unit 1 Introduction to Mobile Computing, evolution, mobility concepts, Android/iOS overview, Android architecture, Android Studio, SDK/Gradle, Activity lifecycle, Android components, applied architecture scenarios. Unit 2 UI/UX principles, layouts, widgets, intents, menus, navigation, responsive design, event/gesture handling, accessibility, wireframing/prototyping, applied UI designs.

UNIT 1 - Introduction to Mobile Computing and Android

1. Mobile Computing: Meaning, Components, Advantages and Applications

Mobile Computing is a computing environment in which users can access, process, and exchange information

while moving from one location to another. It combines portable computing devices, wireless communication,

and mobile software so that a user is not tied to a fixed desk or wired network.

Key point: Mobile Computing = Mobile Hardware + Mobile Communication + Mobile Software.

Main component Purpose Examples Mobile hardware Provides portable computing capability. Smartphone, tablet, smartwatch, laptop, handheld scanner Mobile communication Transfers voice/data cable. without a fixed Wi-Fi, 4G/5G, Bluetooth, NFC, satellite Mobile software Provides the operating environment and applications.^ Android, iOS, mobile banking app, maps app Advantages of Mobile Computing

 Anywhere/anytime access to information

 Higher workforce productivity

 Real-time communication and collaboration

 Location-aware and context-aware services

 Fast business transactions and field operations

 Improved customer service and remote monitoring

Mobile Computing vs Traditional Computing Aspect Mobile Computing Traditional Computing Location User can move while using the system. Usually used at a fixed location. Connectivity Mostly wireless and can change networks. Often wired or stable LAN connectivity. Power Battery constrained. Usually continuous mains power.

Screen/Input Smaller screen; touch, voice, sensors. Larger display; keyboard/mouse common. Context Can use GPS, camera, motion and proximity. Usually less context-aware. Resources Resource and thermal limits matter more.^ Typically fewer mobility constraints. -related Applications of Mobile Computing Application area Example Banking UPI/mobile banking and account alerts Healthcare Telemedicine, health monitoring Education Mobile LMS and virtual classrooms Transportation Ride hailing, navigation, ticketing Retail Mobile shopping and payments Business Field sales, inventory, CRM Emergency services Location-based alerts and coordination Mini example: check whether a network is available (Kotlin) val cm = getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager val network = cm.activeNetwork if (network != null) { Toast.makeText(this, "Network available", Toast.LENGTH_SHORT).show() }

2. Evolution of Mobile Computing and Wireless Communication

Mobile computing evolved because computing devices became smaller, wireless networks became faster,

and mobile operating systems matured. The progression can be understood as a movement from portable

devices with limited connectivity to smart, cloud-connected, sensor-rich devices.

Stage Representative development Effect Early portable computing Laptops, pagers, basic cellular phones Portability but limited data capability 2G era Digital voice and SMS Reliable mobile communication 2.5G/3G Packet data and mobile web Internet access on phones Smartphone era Touchscreens, app stores, GPS, cameras Rich application ecosystem 4G High-speed mobile broadband Streaming, real-time apps, cloud services 5G and edge era Higher capacity, low-latency use cases IoT, AR/VR, connected industry, smart mobility

Wireless communication means transmitting data between devices without a physical cable. Radio-frequency

technologies such as Wi-Fi, cellular networks, Bluetooth, and NFC allow a mobile device to communicate

while stationary or moving.

Conceptual wireless communication flow

[Mobile Device] ~~~ wireless signal ~~~> [Access Point / Cell Tower] | | +-------- Mobile Application ----------+----> Internet / Cloud Service Mini example: open Wi-Fi settings (Kotlin) val intent = Intent(Settings.ACTION_WIFI_SETTINGS) startActivity(intent)

Important Android Features

 Open-source core platform

 Large device ecosystem

 Multitasking and background work support

 Rich notification system

 Google services integration

 Multiple screen sizes and hardware profiles

Important iOS Features

 Tight hardware-software integration

 Consistent user interface guidelines

 Strong application sandboxing

 Centralized platform updates

 Optimized performance across a smaller hardware range

 Integrated Apple services

Android mini example: display a short message (Kotlin) Toast.makeText(this, "Hello Android", Toast.LENGTH_SHORT).show()

5. Android vs iOS: Architecture, Openness, Security and Development Criterion Android iOS Architecture Linux runtime/framework layers.-based stack with Android Apple platform stack with Darwin/XNU foundations and Cocoa Touch frameworks. Openness Core platform is substantially open source; OEM customization is common. Platform is proprietary and tightly controlled. Security model App sandbox, permissions, signing, Play protection mechanisms.^ App sandbox, entitlements, code signing, strict ecosystem controls. Development tool Android Studio + Android SDK + Gradle. Xcode + iOS SDK + Swift toolchain. Testing challenge Many screen sizes, vendors and OS versions.^ Smaller device range but strict Apple platform rules. Customization High for users and manufacturers. Lower, with emphasis on consistency.

Android is often attractive when broad device reach, hardware variety, customization, or flexible deployment is

important. iOS can be attractive when an organization values a controlled hardware ecosystem, uniform

device behavior, and tight platform governance. Enterprise platform choice should be based on the workforce

devices, security policy, existing infrastructure, development expertise, total cost, and application

requirements rather than assuming one platform is universally best.

Key point: For many enterprises, the best practical strategy is cross-platform or dual-platform support when both

Android and iPhone users must be served.

6. Android Studio, Android SDK, SDK Manager and Gradle

Android Studio is the official integrated development environment (IDE) used to create, test, debug, profile,

and package Android applications. It provides a code editor, layout tools, emulator integration, debugger,

profiler, version-control support, and Gradle integration.

The Android SDK (Software Development Kit) is a collection of platform APIs, build tools, emulator

components, command-line tools, and libraries required to develop Android applications.

SDK Manager is used inside Android Studio to install and update Android platform versions, build tools,

platform tools, system images, and related components.

Gradle is Android's build automation system. It resolves dependencies, compiles source code and resources,

creates build variants, runs tasks, and packages the app into APK/AAB outputs.

Mini Gradle dependency example (Kotlin DSL (build.gradle.kts)) dependencies { implementation("androidx.core:core-ktx:VERSION") implementation("androidx.appcompat:appcompat:VERSION") }

7. Creating an Android Project and Understanding Project Structure

1. Open Android Studio and choose New Project.

2. Select an appropriate template such as Empty Views Activity.

3. Enter application name, package name, save location and language (Kotlin).

4. Choose a suitable minimum Android SDK according to the target users/devices.

5. Finish project creation and allow Gradle synchronization to complete.

6. Run the app on an emulator or physical Android device.

Typical Android project structure (simplified)

app/ |-- manifests/ | -- AndroidManifest.xml |-- kotlin+java/ |-- com.example.app/ - > Kotlin/Java source files |-- res/ | |-- layout/ - > XML screen layouts | |-- drawable/ - > images/shapes | |-- mipmap/ - > launcher icons | |-- values/ - > strings, colors, themes, dimensions | -- xml/ - > configuration XML files |-- build.gradle.kts - > module build configuration-- proguard-rules.pro - > code shrinking/obfuscation rules Folder/file Purpose AndroidManifest.xml Declares app components, permissions, app metadata and intent filters. kotlin+java Application source code. res/layout Classic View-based XML layouts. res/drawable Drawable resources, shapes and images. res/values Strings, themes, colors, dimens and other values. build.gradle.kts Dependencies and build configuration. Mini manifest example (XML)

Key point: Android applications normally access hardware through Android framework APIs rather than directly

programming Linux device drivers.

10. Applied Design: Architecture of an Online Shopping Mobile App

Example e-commerce architecture

[Login / Product / Cart / Checkout Screens] | v [ViewModel / Presentation Logic] | v [Use Cases: Search, Add to Cart, Pay, Order] | v [Repository Layer] ---> [Local Cache / Room] | +-----------> [REST API / Cloud Backend] | [Products, Orders, Payments DB] Layer Shopping example UI Product list, product details, cart, checkout, order tracking. Presentation logic Maintains screen state and responds to user actions. Domain Price calculation, stock rules, coupon validation, checkout workflow. Data Repository decides whether data comes from local cache or remote API. Backend Authentication, inventory, payment gateway integration, order database. Mini model example (Kotlin) data class Product( val id: Int, val name: String, val price: Double )

11. Android Activity and Activity Lifecycle

An Activity represents a user-facing screen or a major interactive entry point in an Android application. The

Activity lifecycle describes the states an Activity passes through as it is created, shown, interacted with,

partially covered, hidden, and destroyed.

Simplified Activity lifecycle

onCreate() | v onStart() | v onResume() <---- user can interact with screen | v onPause() |

v onStop() | +----> onRestart() - > onStart() - > onResume() | v onDestroy() Callback Typical purpose onCreate() Initial setup, inflate layout, initialize objects and restored state. onStart() Activity becomes visible. onResume() Activity enters foreground and becomes interactive. onPause() Another screen partially covers it; pause short-lived work. onStop() No longer visible; release heavier visible-only resources. onRestart() Called when a stopped Activity is coming back. onDestroy() Final cleanup before the Activity instance is destroyed.

Difference between onCreate() and onStart(): onCreate() is mainly for one-time initialization of a particular

Activity instance; onStart() is called whenever that Activity becomes visible, including after returning from the

stopped state.

Relationship of onPause() and onResume(): onPause() is used when the Activity loses foreground focus;

onResume() is used when it regains the foreground and user interaction can continue.

Activity lifecycle logging example (Kotlin) class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) Log.d("LifeCycle", "onCreate") } override fun onResume() { super.onResume() Log.d("LifeCycle", "onResume") } override fun onPause() { Log.d("LifeCycle", "onPause") super.onPause() } }

12. Activity Lifecycle During Screen Rotation

A configuration change such as screen rotation may cause the current Activity instance to be destroyed and

recreated so that resources appropriate to the new configuration can be loaded. Therefore, UI state should

not be stored only in temporary view variables.

Conceptual rotation flow

Portrait Activity running | rotate device v onPause() - > onStop() - > onDestroy() | v

override fun onBind(intent: Intent?) = null }

When is a Service more suitable than an Activity? Use a Service when the task must continue even when the

user leaves the current screen, and the task does not need its own full UI. Music playback is the classic

example: the music should continue after the user opens another app.

16. Broadcast Receiver: Event-Oriented Component

A Broadcast Receiver reacts to broadcast messages from the system or an application. Its work should

normally be short; long work should be delegated to an appropriate background mechanism.

Broadcast Receiver skeleton (Kotlin) class PowerReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Toast.makeText(context, "Power event received", Toast.LENGTH_SHORT).show() } } Advantages Limitations Loose coupling between event sender and receiver. Receiver execution should remain brief. Useful for system/app events. Background execution restrictions can affect behavior. Can trigger app logic without opening a screen. Improper use can create unnecessary battery/network work. Supports custom in-app broadcast patterns. Sensitive events/data require careful security design.

17. Content Provider: Structured Data Sharing

A Content Provider exposes structured application data using content URIs. Other components can use a

ContentResolver to query, insert, update, or delete data when permission is granted. Android's Contacts

provider is a familiar example.

Query the contacts provider (simplified) (Kotlin) val cursor = contentResolver.query( ContactsContract.Contacts.CONTENT_URI, null, null, null, null ) cursor?.use { while (it.moveToNext()) { val name = it.getString( it.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME) ) Log.d("Contact", name) } }

Data security can be maintained by declaring appropriate read/write permissions, exporting a provider only

when required, validating caller input, limiting exposed columns/operations, and avoiding storage of sensitive

data in insecure locations.

18. Applied Design Using All Four Android Components

Consider a music application that downloads and plays songs while showing notifications and sharing a small

public playlist catalog.

Component Role in the example app Activity Shows song list, player controls and settings. Service Keeps music playback active when the Activity is not visible. Broadcast Receiver Responds to headset, connectivity, or custom playback- control events. Content Provider Shares selected playlist/catalog data with trusted clients.

Component interaction

[Activity / Player Screen] | start/control v [Music Service] <---- [Broadcast Receiver] | +---- reads/writes ----> [App Database] ^ | [Content Provider] - > authorized client

19. Choosing the Correct Android Component for Common Scenarios Scenario Recommended component(s) Reason Music player Activity + foreground Service Activity provides controls; Service keeps playback running. Alarm application Broadcast Receiver + scheduling API + Activity^ Receiver handles scheduled e Activity configures alarm. vent; SMS notification Broadcast/event handling + Notification; Activity if user opens details Event-oriented handling is needed; UI is optional until user interacts. Contacts application Activity + Content Provider/ContentResolver UI displays contacts; provider gives structured access to contact data. 20. Impact of Mobile Computing on Modern Business Positive impact Business effect Real-time access Managers and staff make faster decisions. Mobile commerce Customers can purchase and pay from anywhere. Field automation Sales, service and logistics staff update data on-site. Location services Delivery tracking, nearby offers and route optimization. Remote work Teams collaborate away from offices. Customer engagement Push notifications, in-app support and personalized services.

Important limitations include device fragmentation, security/privacy risk, battery constraints, unreliable

connectivity, mobile data cost, platform-specific maintenance, and the need to design for smaller screens and

interruptions.

23. LinearLayout

LinearLayout arranges child views sequentially either vertically or horizontally. It is easy to understand, but

deeply nested LinearLayouts can make a complex screen inefficient and harder to maintain.

LinearLayout example (XML)

24. RelativeLayout

RelativeLayout positions child views in relation to the parent or to other views. It was widely used before

ConstraintLayout became the preferred choice for many complex View-based screens.

RelativeLayout example (XML)

25. ConstraintLayout

ConstraintLayout places each view by connecting its edges to the parent or other views. It reduces the need

for deeply nested layouts and is usually a strong choice for complex responsive screens in classic Android

Views.

ConstraintLayout example (XML)

app:layout_constraintTop_toTopOf="parent" />

Advantages include flatter view hierarchies, flexible alignment, chains/guidelines, percentage-like positioning

through constraints, and good support for responsive designs.

26. FrameLayout

FrameLayout is a simple container designed primarily to display one child or stack multiple children on top of

one another. It is useful as a fragment host or for overlays.

FrameLayout example (XML)

27. Comparing Layouts and Selecting a Layout for a Login Screen Need Suggested layout Reason Very simple vertical form LinearLayout Easy to read and implement. Legacy relative rules RelativeLayout Supports relative positioning but is less preferred for new complex screens. Responsive login with logo, fields, button and constraints ConstraintLayout^ Flexible placement with a flatter hierarchy. Single content host or overlay FrameLayout Designed for stacking/hosting rather than form arrangement.

For a modern login screen, ConstraintLayout is usually the most flexible classic View-based choice because it

can position the logo, email field, password field and login button relative to the parent and to one another

without deep nesting. A simple LinearLayout is also acceptable when the screen is strictly vertical and

uncomplicated.

28. Common Android Widgets Widget Purpose Typical use TextView Displays text. Title, label, output text Button Triggers an action. Login, Submit, Save ImageView Displays an image/drawable. Logo, product image, icon EditText Accepts editable text input. Name, email, password CheckBox Independent yes/no option. Accept terms, interests RadioButton One option in a mutually exclusive group. Gender/type/category selection Switch On/off setting. Notifications enabled Spinner Compact list selection. Choose city/category Simple TextView + Button + EditText + ImageView (XML)

startActivity(intent)

32. Menus in Android

Menus provide commands and actions without occupying excessive screen space. Common menu forms

include an options/app-bar menu, contextual menu/contextual action mode, and popup menu.

Menu type Use Options/App-bar menu Global actions for the current screen such as Search, Settings, Refresh. Context menu / contextual action Actions related to a selected item. Popup menu Small menu anchored to a particular view such as a three button. -dot PopupMenu example (Kotlin) val popup = PopupMenu(this, moreButton) popup.menuInflater.inflate(R.menu.item_menu, popup.menu) popup.setOnMenuItemClickListener { item - > Toast.makeText(this, item.title, Toast.LENGTH_SHORT).show() true } popup.show()

33. Navigation Components

Android Navigation Components provide structured navigation between destinations. A navigation graph

describes destinations and actions; a NavController performs navigation; and a NavHost displays

destinations. Benefits include centralized navigation structure, back-stack handling, safer argument passing

patterns, and easier support for app bars and deep links.

Navigate using a NavController (Kotlin) findNavController(R.id.nav_host_fragment) .navigate(R.id.action_homeFragment_to_detailsFragment)

34. Responsive UI Design

Responsive UI design means the interface adapts to different screen sizes, orientations, densities, and device

categories while remaining usable. A responsive Android UI should avoid hard-coded pixel dimensions and

should use flexible constraints, scalable resources, and alternative layouts when necessary.

Technique Purpose Use dp for dimensions Keeps densities.^ physical UI size more consistent across screen Use sp for text Respects scaled text/user font preferences. Constraint-based layouts Allows elements to adapt instead of using fixed coordinates. Resource qualifiers Provide alternatives such as different layouts/dimens for larger screens. Flexible containers/lists RecyclerView and adaptive containers handle varying content. Test orientation and large screens Prevents clipping and inefficient use of tablet space.

Density-independent pixel (dp) is a logical unit used for layout dimensions. Android scales dp according to

screen density so that a 48dp control has approximately similar perceived size across devices. Text is

normally sized in sp so user font scaling can be respected.

Responsive dimension example (XML)

35. Applied Responsive Design for Smartphones and Tablets

Adaptive content strategy

PHONE (compact width) TABLET (expanded width) +---------------------+ +------------------------------+ | Product List | | Product List | Product Detail| | tap item - > detail | | | | +---------------------+ +------------------------------+

On a phone, a master-detail app may show one destination at a time. On a tablet, the same information can

be displayed in two panes so that the list and details are visible together. This is a better use of large-screen

space than simply stretching a phone interface.

36. Event Handling in Android

Event handling is the process of detecting user/system actions and executing code in response. Common UI

events include click, long click, text change, checked change, touch, focus, and gesture events.

Button click event (Kotlin) val button = findViewById(R.id.btnSave) button.setOnClickListener { Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show() } CheckBox checked-change event (Kotlin) checkBox.setOnCheckedChangeListener { _, isChecked - > statusText.text = if (isChecked) "Enabled" else "Disabled" }

37. Gesture Handling

Gestures interpret touch sequences such as tap, double-tap, long press, swipe, scroll, and fling. Gesture

handling should be used carefully because invisible gestures can be difficult for users to discover; important

actions should also have clear visual controls when possible.

Very small GestureDetector example (Kotlin) val detector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() { override fun onDoubleTap(e: MotionEvent): Boolean { Toast.makeText(this@MainActivity, "Double tap", Toast.LENGTH_SHORT).show() return true } }) view.setOnTouchListener { _, event - > detector.onTouchEvent(event) }

[Send] [Pay] [Deposit] Recent Transactions Grocery - Rs. 1200 Salary + Rs. 50000 ---------------------------- Home Pay Cards More

+----------------------------+

7. Create frames for main screens such as Login, Home, Transfer, Transaction Details and Profile.

8. Place low-fidelity boxes, labels and buttons to confirm information hierarchy.

9. Create interactive links between buttons and destination frames.

10. Run the prototype and check whether a new user can understand the navigation.

11. Convert the approved wireframe into a high-fidelity prototype using final typography, color, icons and

components.

41. High-Fidelity Prototype for an Online Shopping Application Screen Important UI elements Home Search, categories, recommendations, product navigation.^ cards, bottom Product details Large image, title, price, rating, variants, Add to Cart button. Cart Items, quantity controls, price summary, remove action, checkout. Checkout Address, delivery, payment method, order summary, place order action. - Order tracking Order status timeline, delivery details, support link.

Key point: A high-fidelity prototype should demonstrate not only visual appearance but also interaction states:

pressed buttons, validation errors, empty cart, loading, success and failure states.

42. Navigation Flow for a Food Delivery Application

Food delivery navigation flow

[Splash/Login] | v [Home / Restaurants] ---> [Restaurant Details] ---> [Cart] | | v v [Search] [Checkout] | v [Order Tracking]

Navigation Components are suitable for internal app destinations such as Home - > Restaurant - > Cart.

Implicit Intents are useful when handing a task to another app, for example opening a map for navigation or

launching a phone dialer to contact support.

43. Layout Recommendation for a Complex E-Commerce Screen

For a complex View-based e-commerce screen, ConstraintLayout is usually the strongest general-purpose

layout because it supports flexible alignment and helps avoid deep nesting. However, real applications

combine layouts and specialized containers: RecyclerView for product lists, ConstraintLayout for each product

card, FrameLayout for content hosts/overlays, and adaptive navigation containers for larger screens.

Key point: Do not treat layout selection as one layout for the entire app. Choose the best container for each

screen section.

44. Integrated Example: Registration UI with Layout, Widgets and Event Handling Registration click validation (Kotlin) val name = etName.text.toString().trim() val email = etEmail.text.toString().trim() btnRegister.setOnClickListener { when { name.isBlank() - > etName.error = "Name required" email.isBlank() - > etEmail.error = "Email required" !cbTerms.isChecked - > Toast.makeText(this, "Accept terms", Toast.LENGTH_SHORT).show() else - > Toast.makeText(this, "Registration successful", Toast.LENGTH_SHORT).show() } }

The UI should also use appropriate input types, clear labels, visible error messages, a disabled/loading state

during network submission, and accessible focus order.

45. User-Friendly Healthcare Application Interface Design requirement Recommended approach Clarity Use plain labels such as Appointments, Medicines, Reports. Safety Confirm destructive or critical actions and clearly identify patient/account context. Accessibility Large readable text, high contrast, scalable fonts, descriptive icons. Navigation Keep primary tasks reachable from a simple bottom navigation or dashboard. Privacy Avoid displaying sensitive information unnecessarily on shared screens/notifications. Error prevention Validate forms and provide clear recovery guidance.

Healthcare home screen concept

| Good Morning | | [Book Appointment] | | [My Medicines] | | [Lab Reports] |

[Emergency Contact] Home Appointments Profile

+----------------------------+

46. Framework for Evaluating an Existing Mobile Application

When evaluating a popular application, avoid judging only by appearance. Use a repeatable framework based

on task completion and user needs.

Area Possible improvement examples Usability Reduce unnecessary steps in checkout/login. Accessibility Add missing content descriptions and improve contrast. Navigation Make back behavior predictable and keep primary destinations consistent.