Mobile Application Assignment


MobileApplication Assignment



MobileApplication Assignment

Q1.(2 Marks)

Explainin details the activity life cycle of an android application with thehelp of


Anactivity is a single focused occurrence that a given user canachieve. At least, all activities have the tendency to interact withthe user. The activity has a task of creating a User Interface withsetContent (view) (

Activitiesin the system are managed as an activitystack.

Allactivities have 4 critical cycles:

  • Running or active:-The foreground of the screen contains the activity. It is found at the top of the stack (

  • Paused:-The activity has misplaced (killed) its prime concentration but it is still alive. It is paused. It upholds all states and remains attached to the window manager (

  • Stopped:-The activity is killed by another activity. It will retain all state and information but it’s no longer visible and thus its windows is hidden (

  • Finish:-When the activity is stopped, the system will drop from memory by killing it or finishing it. If it’s to be displayed again, it should be restored to its previous state (

The following diagram shows theactivity life cycle of an android application:

Figure1 Android Life Cycle

Q2. (1 Mark)

Whatare Adapters in android, explain different adapter views

Adaptersare platform that acts as a bridge between AdapterView and thefundamental data needed for that view. The adapter runs admission tothe data items. The Adapter has the sole purpose for developing aView for each element in the data set. Different Adapter views are(

  • ArrayAdapter

  • SimpleCursorAdapter

  • CursorAdapter

  • BaseAdapter

  • ListAdapter

Q3(1 Mark)

Explainthe Android location services and the classes required for gettingGPS location.

Applicationsin the Android are given an access to the location services sustainedby the gadget, by classes in the android. location package.Criticalconstituent of the location background is LocationManagersystemservice. It offers APIs to define location and bearing of the basicavailable device. Maps are be added to the Apps that are based onGoogle Maps data (,based on the&nbspGoogleMaps Android API.

Themain class in the Google Maps Android API is&nbspMapView.MapView&nbsppresentsa map, and the data is extracted from Google Maps service(

Q4.(2 Marks)

a) Thefollowing figure shows a part of Android application manifest file.










Discussin details what is meant by part number //1 and //2

//1 – The first line declares the start of the manifest along with aURL that holds a path which explains the usage of the namespaces.Package allows for naming of the project following java packagesystem. This will allow application from the same publisher to seaton the same path hierachy when the `.` (period) is considered as afolder separator.

com.adobe.illustrator com/adobe/illustrator

com.adobe.photoshop com/adobe/photoshop

com.adope.reader com/adope/reader

Versioncode holds the numerical representation of the current applicationversion while version name is the name of the current version.

//2– This declares the maximum (android:maxSdkVersion),minimum (android:minSdkVersion)and the target(android:targetSdkVersion)android sdk versions required to run this application. As shownabove, this application requires devices with android sdk 8 and aboveand is build with sdk 17. Currently it has no maximum sdk versionset.

b) Inthe previous figure, what changes are required to do if you made anew version of your application “1.1”, also a new SDK version 18is available









Q5.(4 Marks)

Inthe following activity, complete the following code in order thatwhen a user

pressADD button the sum of the two numbers in (txtnum1, txtnum2) willappear


finalEditText txtNum1 = (EditText)findViewById(

finalEditText txtNum2 = (EditText)findViewById(

finalTextView lblResult = (TextView)findViewById(

finalButton btnAdd = (Button)findViewById(

btnAdd.setOnClickListener(newOnClickListener() {


publicvoidonClick(View v) {

floatfloat_1 = Float.parseFloat(txtNum1.getText().toString())

floatfloat_2 = Float.parseFloat(txtNum2.getText().toString())





Retrieved28 Oct, 2015 from