You are on page 1of 8

Apollo Institute of Engineering and technology

Department of Computer Engineering

Mobile Application Development


Question Bank
1. Explain SDLC.
2. Explain android architecture in details.
3. What is SDK, ADB, APK, AAPT?
4. What is DVM? How DVM differs from JVM? Explain source code compilation process of
android application using DVM.
5. What is activity? Explain activity life cycle with java code showing the working of activity
life cycle.
6. List and explain android components or building blocks of android.
7. List and explain different type’s android applications.
8. What is Android Manifest file? Why it is required? Explain elements of android manifest
file.
9. What is intent in android? List and explain types of intents with proper java code.
Answer: https://www.tutlane.com/tutorial/android/android-intents-implicit-explicit
Implicit: https://www.tutlane.com/tutorial/android/android-implicit-intents-with-e xamples
Explicit: https://www.tutlane.com/tutorial/android/android-explicit-intents-with-examples
10. What is fragment in android? Explain fragment life cycle with proper java code. Also
write XML file for the same.
11. What is layouts in android? Why it is needed? List and explain each layouts with proper
XML file showing its use.
12. What is menu in android? List and explain each menu with proper java code and XML
file.
13. List different types of storages available in android. Explain each with proper java code.
14. Develop a simple database program showing use of CREATE, INSERT, UPDATE, DELETE
and SELECT query.
15. What is web service in android? What is its purpose? Explain android JSON parsing with
proper example and advantages.

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

16. What is AsyncTask in android? Demonstrate with simple java code.


17. Explain Location based services (LBS) in android with its use?
18. Explain Geocoder service in android.
19. Write down the steps to publish android application publicly.
20. What is the use of animation in android? List the types of animations available in
android. Demonstrate its use with proper java and xml file.
21. Perform CRUID operation using Firebase database.
22. How to manage Bluetooth and Wi-Fi services in android.
23. Demonstrate the use of sensor in android.

-------------------------------------------------------------------------------------------------------------------------------
Android Intent
Android Intent is the message that is passed between components such as activities, content
providers, broadcast receivers, services etc.
It is generally used with startActivity() method to invoke activity, broadcast receivers etc.
The dictionary meaning of intent is intention or purpose. So, it can be described as the intention
to do action.
Android intents are mainly used to:

 Start the service


 Launch an activity
 Display a web page
 Display a list of contacts
 Broadcast a message
 Dial a phone call etc.
Types of Android Intents
There are two types of intents in android: implicit and explicit.
1) Implicit Intent
Implicit Intent doesn't specifiy the component. In such case, intent provides information of
available components provided by the system that is to be invoked.
For example, you may write the following code to view the webpage.

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

Intent i = new Intent(Intent.ACTION_VIEW);


intent.setData(Uri.parse("http://www.google.com"));
startActivity(i);
2) Explicit Intent
Explicit Intent specifies the component. In such case, intent provides the external class to be
invoked.
Intent i = new Intent(getApplicationContext(), ActivityTwo.class);
startActivity(i);
To get the full code of explicit intent, visit the next page.

Android Implicit Intent Example


Let's see the simple example of implicit intent that displays a web page.
File: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.implicitintent.MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

android:layout_marginTop="60dp"
android:ems="10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.575"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginLeft="156dp"
android:layout_marginTop="172dp"
android:text="Visit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText" />
</android.support.constraint.ConstraintLayout>
Activity class
File: MainActivity.java
package example.javatpoint.com.implicitintent;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

Button button;
EditText editText;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

button = findViewById(R.id.button);
editText = findViewById(R.id.editText);

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String url=editText.getText().toString();
Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}
});

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

}
}

JSON (JavaScript Object Notation) is a programming language. It is minimal, textual, and a


subset of JavaScript. It is an alternative to XML.
Android provides support to parse the JSON object and array.
Advantage of JSON over XML
1) JSON is faster and easier than xml for AJAX applications.
2) Unlike XML, it is shorter and quicker to read and write.
3) It uses array.
json object
A JSON object contains key/value pairs like map. The keys are strings and the values are the
JSON types. Keys and values are separated by comma. The { (curly brace) represents the json
object.
{
"employee": {
"name": "A",
"salary": 1000,
"married": true
}
}
json array
The [ (square bracket) represents the json array.
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Let's take another example of json array.
{ "Employee" :
[

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

{"id":"1","name":"A","salary":"1000"},
{"id":"2","name":"B","salary":"2000"}
]
}
Code:
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
public static final String JSON_STRING="{\"employee\":
{\"name\":\"Sachin\",\"salary\":56000}}";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView1=(TextView)findViewById(R.id.textView1);
try{
JSONObject emp=(new JSONObject(JSON_STRING)).getJSONObject("employee");
String empname=emp.getString("name");
int empsalary=emp.getInt("salary");

String str="Employee Name:"+empname+"\n"+"Employee Salary:"+empsalary;


textView1.setText(str);
}

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in
Apollo Institute of Engineering and technology
Department of Computer Engineering

catch (Exception e) {
}
}
}

PROF. RAVIKANT THAKKARBHAI


Rtv@aiet.edu.in

You might also like