An activity is one screen of an app with its own user interface. Android moves it through a life cycle of callbacks such as onCreate, onStart, onResume, onPause, onStop and onDestroy.
Write these points
Callbacks in order
onCreate: called once. Build the screen and set up data.
onStart: the screen becomes visible.
onResume: the screen is in front and the user can touch it.
onPause: another screen is coming forward. Save light data here.
onStop: the screen is hidden.
onDestroy: the activity is removed from memory.
Between onStart and onStop the activity is visible. Between onResume and onPause it is in the foreground.
If the user comes back to a stopped activity, onRestart runs, then onStart.
A screen rotation destroys and recreates the activity unless the app handles it.
Call order for a rotation.
App open on screen A. User rotates the phone.
Calls: onPause, onStop, onDestroy, then onCreate, onStart, onResume.
Total 6 callbacks run. State saved in onSaveInstanceState can be restored in onCreate.
Remember. The callback names are standard Android terms. The code samples in this PDF were not compiled or run.
Real-life example
A shop assistant opens the shop in the morning, serves customers, steps aside when the owner arrives and closes at night. Each step has a fixed routine. An activity follows a fixed routine for each change in its state.
Figure: activity life cycle
Same or opposite: onPause and onStop
Point
onPause
onStop
Same or opposite
Activity is
Partly hidden or losing focus
Fully hidden
Opposite
Work to do
Quick save
Heavier release of resources
Opposite
Is a life cycle callback
Yes
Yes
Same
Called first
Yes
After onPause
Opposite
Exam tip. Draw the life cycle diagram with the six callbacks. State what each one is used for.
Q2. Intents: explicit, implicit and intent filters
From the syllabus · Unit 2
From the papers
“Unit 2: Intents, receiving and broadcasting intents, using intent filter.” (Syllabus)
The short answer
An intent is a message object that asks Android to start an activity or a service or to deliver a broadcast. It can name the target (explicit) or only describe the job (implicit).
Write these points
Two kinds
Explicit intent: names the exact class, used inside your own app.
Implicit intent: gives an action and data. Android picks an app that can do it.
An intent filter in the manifest tells Android which implicit intents a component accepts.
Extra data travels in a Bundle as key and value pairs.
Intent i = new Intent(this, SecondActivity.class); // explicit
i.putExtra("name", "Asha");
startActivity(i);
Intent v = new Intent(Intent.ACTION_VIEW, Uri.parse("https://paperwala.org")); // implicit
startActivity(v);
Filter part
Meaning
action
The job, for example VIEW or SEND
category
Extra info, for example DEFAULT
data
Type or URI the component can handle
Matching an implicit intent.
Intent: action SEND, type text/plain. Two apps declare filters: A accepts SEND with text/plain. B accepts VIEW with image/png.
A matches the action and the type. B matches neither.
Android offers only A.
Remember. The Java code was not compiled or run.
Real-life example
Telling a taxi driver the exact house number is explicit. Saying only that you want to go to a railway station is implicit. The driver, or Android, picks the route.
An implicit intent
Same or opposite: explicit and implicit intent
Point
Explicit
Implicit
Same or opposite
Target
Named class
Chosen by Android
Opposite
Usual use
Inside one app
Across apps
Opposite
Can carry extras
Yes
Yes
Same
Needs intent filter
No
Yes, on the receiver
Opposite
Exam tip. Show both lines of code. Then explain the intent filter in one sentence.
The Android platform is an open source software stack for phones. It has a Linux kernel at the bottom and apps at the top.
Write these points
Layers
Linux kernel: drivers for display, camera and memory, plus security.
Hardware abstraction layer and native libraries: SQLite, graphics, media and the C library.
Android runtime: runs the app code. Older versions used Dalvik. Newer versions use ART.
Application framework: managers for activities, resources, location and notifications.
Applications: the phone app, browser and your own apps.
Layer
Example
Applications
Contacts, your app
Framework
Activity manager
Runtime and libraries
ART, SQLite
Kernel
Display and camera drivers
Following a tap on a contact.
The Contacts app (layer 1) asks the framework (layer 2) to open a screen.
The framework uses the runtime and libraries (layer 3) to draw it.
The kernel (layer 4) talks to the display driver. Data moves through 4 layers.
Remember. Some books show five layers. They list the hardware layer or the libraries on their own. Follow your textbook figure.
Real-life example
A restaurant has the guests, the waiters, the kitchen and the gas supply. The guests see only the menu. Android works in the same stack. The user sees apps. The kernel does the hard work underneath.
Figure: Android software stack
Same or opposite: Dalvik and ART
Point
Dalvik
ART
Same or opposite
Compile style
Just in time
Ahead of time
Opposite
App start
Slower
Faster
Opposite
Runs Android app code
Yes
Yes
Same
Used in
Older Android
Newer Android
Opposite
Exam tip. Draw the stack with names on each layer. Mention the runtime, since many students leave it out.
“Unit 1: Anatomy of an Android application, Android manifest file.” (Syllabus)
The short answer
The Android manifest file is AndroidManifest.xml at the root of every app. It tells Android the app name, its components, its permissions and its needs.
Write these points
What it holds
The package name that identifies the app.
Every activity, service, receiver and provider the app uses.
The permissions the app asks for.
Intent filters that say what each component can handle.
The launcher activity, which opens first. Also the minimum Android version.
src or java: your code. res: layouts, images and strings. gen or R.java: ids made by the tools.
Why a screen crashes.
App has MainActivity and SettingsActivity. Only MainActivity is in the manifest.
startActivity to SettingsActivity fails with an error.
Fix: add one activity line. 1 missing line broke the app.
Remember. The XML was not run in a real project. Some books say Eclipse and ADT. New projects use Android Studio.
Real-life example
A new hostel student fills a form with name, room needs and allowed visitors. The warden reads the form before anything else. Android reads the manifest first in the same way.
Figure: contents of the manifest
Same or opposite: manifest and layout file
Point
Manifest
Layout
Same or opposite
Describes
App components and rights
One screen design
Opposite
Number per app
One
Many
Opposite
Is an XML file
Yes
Yes
Same
Read by
Android system at install
The UI system at run
Opposite
Exam tip. Write a short manifest with a permission and the launcher activity. List the contents as points.
First button: 360 x 1 / 3 = 120 dp. Second button: 360 x 2 / 3 = 240 dp.
On a larger screen the same 1 to 2 ratio holds.
Remember. The XML was not run. Sizes are in dp, so they scale with screen density.
Real-life example
Arranging furniture in a room can be done in a straight line along a wall, or by saying the lamp goes next to the sofa. Linear and relative layouts do the same for buttons and text.
Figure: common layouts
Same or opposite: LinearLayout and RelativeLayout
Point
LinearLayout
RelativeLayout
Same or opposite
Placement
One row or column
By position to other views
Opposite
Nesting needed
Often
Less
Opposite
Is a ViewGroup
Yes
Yes
Same
Best for
Simple lists of views
Complex positions
Opposite
Exam tip. Name at least four layouts and write a short XML. The weights example shows you can compute sizes.
SQLite is a small database engine built into Android. An app keeps structured data in tables and reads it with SQL.
Write these points
How an app uses it
Extend SQLiteOpenHelper and write onCreate and onUpgrade.
onCreate runs the CREATE TABLE statements the first time.
Call getWritableDatabase to insert, update or delete. Call getReadableDatabase to read.
A Cursor walks through the rows that a query returns.
Each app database is private to that app.
db.execSQL("CREATE TABLE student(id INTEGER PRIMARY KEY, name TEXT, marks INT)");
ContentValues v = new ContentValues();
v.put("name", "Asha"); v.put("marks", 72);
db.insert("student", null, v);
Cursor c = db.rawQuery("SELECT name FROM student WHERE marks > 60", null);
A query on three rows.
Table rows: Asha 72, Ravi 58, Meena 81.
SELECT name WHERE marks > 60 ORDER BY marks DESC returns Meena, Asha.
Average marks = (72 + 58 + 81) / 3 = 70.33. After adding 5 to Ravi, his marks are 63.
Remember. The SQL results were run with Python sqlite3 on the same table. The Java lines were not compiled.
Real-life example
A school clerk keeps a register with columns for name and marks. She can add a row, correct a row or look up all students above 60. SQLite gives an app the same kind of register.
Figure: SQLite in an app
Same or opposite: SQLite and shared preferences
Point
SQLite
Shared preferences
Same or opposite
Data shape
Tables of rows
Key and value pairs
Opposite
Best for
Large, structured data
Small settings
Opposite
Private to the app
Yes
Yes
Same
Query language
SQL
None
Opposite
Exam tip. Write the helper class idea, one insert and one query. Show a tiny table with the result.
Remember. The authority name is made up for this example.
Real-life example
A library lends books by a counter. Members do not walk into the store room. The counter clerk applies the rules. A content provider is that counter for an app's data.
Figure: content provider
Same or opposite: content provider and direct database access
Point
Content provider
Direct database access
Same or opposite
Who can use the data
Other apps
Same app only
Opposite
Control
Permissions and URIs
None needed
Opposite
Can sit on SQLite
Yes
Yes
Same
Setup
More
Less
Opposite
Exam tip. Explain URI, ContentResolver and the four methods. Give one example URI and break it into parts.
A service is a component that runs work in the background without a screen. It can keep running after the user leaves the app.
Write these points
Kinds of service
Started service: begins with startService and runs until it stops itself.
Bound service: other components connect with bindService and use it like a server.
Foreground service: shows a notification so the user knows it is running.
Points to write
A service runs on the main thread by default, so heavy work needs its own thread.
Callbacks: onCreate, onStartCommand, onBind and onDestroy.
A service must be declared in the manifest.
Music player timing.
A song of 3 minutes is playing and the user opens another app.
Without a service the activity may stop and the music ends.
With a started service the song plays for the full 180 seconds. The service calls stopSelf at the end.
Remember. The code is not shown here. Newer Android versions limit background services, so foreground services are used for long tasks.
Real-life example
A cook keeps the pressure cooker on the stove while the family watches television. The family does not look at it, but the work goes on. A service works like the cooker.
Figure: started and bound service
Same or opposite: started and bound service
Point
Started
Bound
Same or opposite
Starts with
startService
bindService
Opposite
Talks to callers
No
Yes
Opposite
Runs without a screen
Yes
Yes
Same
Ends
Stops itself
When the last client unbinds
Opposite
Exam tip. Name the three kinds and the four callbacks. A comparison of started and bound is a common question.
Shared preferences store small amounts of data as key and value pairs in an XML file private to the app. They suit settings such as a theme or a user name.
Write these points
How to use
Get the object with getSharedPreferences(name, mode).
Call edit() to get an Editor.
Use putString, putInt or putBoolean.
Call apply() or commit() to save.
Read with getString or getInt and give a default value.
First run: key user not saved. getString returns guest.
After saving Asha, the next run returns Asha.
Two reads, two values.
Remember. The Java lines were not compiled.
Real-life example
A phone remembers your ringtone and font size. It does not store a whole file. It stores one small value for each setting. Shared preferences are the same kind of memory.
Saving a setting
Same or opposite: apply and commit
Point
apply
commit
Same or opposite
Writes to disk
In the background
At once
Opposite
Returns a result
No
Yes (true or false)
Opposite
Saves the editor changes
Yes
Yes
Same
Blocks the thread
No
Yes
Opposite
Exam tip. Give the five steps in order and the default value idea. Add the three lines of code.
Q10. Application resources and the resource hierarchy
From the syllabus · Unit 4
From the papers
“Unit 4: Managing application resources in a hierarchy, different types of resources.” (Syllabus)
The short answer
Android keeps resources such as layouts, strings and images outside the code in the res folder. It chooses the best version for each device by the folder name.
Write these points
Resource types
layout: screen designs. drawable: images. values: strings, colours and sizes.
menu, anim and raw hold menus, animations and raw files.
Access in code with R.type.name, for example R.string.app_name.
Access in XML with @type/name, for example @string/app_name.
Hierarchy and qualifiers
A folder name adds a qualifier: values-hi for Hindi, layout-land for a wide screen, drawable-hdpi for a screen density.
Android checks the qualifiers against the device and picks the best match. If none matches, it uses the default folder.
Choosing a string.
Folders: values (English) and values-hi (Hindi). Phone language is Hindi.
Android picks values-hi.
For a French phone neither matches, so values (default) is used.
Remember. Folder names follow the Android documentation as I remember it. Check your book for the full qualifier list.
Real-life example
A bank prints its forms in Hindi and English. The clerk hands you the one in your language. If it has no form in your language, you get the English one. Android picks resources the same way.
Figure: choosing resources
Same or opposite: default and alternative resources
Point
Default folder
Qualified folder
Same or opposite
Folder name
values
values-hi or layout-land
Opposite
Used when
No other match
Device matches the qualifier
Opposite
Read through R
Yes
Yes
Same
Required
Yes
Optional
Opposite
Exam tip. Always mention folder names with qualifiers. Show how R.string and @string differ in code and XML.
What are the most important topics in Mobile Application Development?
No past paper of this subject is on this site yet, so the topics were chosen from the syllabus. The first five: Activity and its life cycle; Intents: explicit, implicit and intent filters; Android platform and software stack; Android manifest file and application anatomy; Layouts for user interface design.
How were these Mobile Application Development important questions chosen?
Each topic was taken from the syllabus units. No past paper was available to count repeats, and the answers are not teacher-reviewed, so use them together with your syllabus.
Is there a PDF of Mobile Application Development important questions with answers?
Yes. The Paperwala Imp Question & Answer PDF for Mobile Application Development is free to download from this page.
The 10 topics of Mobile Application Development (AD-703-B) for RGPV B.Tech AI & Data Science semester 7, chosen from the syllabus. No past paper of this subject is on this site yet, so repeats could not be counted. Mobile Application Development is also searched for as SD-801 and Mobile Application Design.