Mad Question Bank

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

MAD QUESTION BANK

Q1. 2 MARKS QUESTIONS

1. List out steps to get API Key


Visit the google cloud platform
Click the project drop down and create new project.
Click the menu button and select APIs and Sevices Credentials
Create Credentials > Api Key //Api key will be displayed here.
Close

2. What is Geocoding & Reverse Geocoding


Finding the geographical cooridinates of a given address or location is
called geocoding and where a pair of longitude and latitude is
converted into an address or location is called as reverse geocoding.

3. State Syntax of use permission tag in android manifest file


<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<!-- Other elements of the manifest file -->
<uses-permission
android:name="android.permission.PERMISSION_NAME" />
</manifest>

4. Explain significance of content provider.


1. Separates data from the app interface code.
2. Provides standard way of accessing data.
3. Make it possible for apps to share data with other apps
4. Content Providers are good.
5. Content providers are useful for the apps.

Q2. 4 Marks Questions

1 Develop an application to send and receive SMS (Write only Java and
permission tag in manifest file).

2 Develop a program to implement i) List view of 5 items ii) Grid view of


4 x 4 items iii) Image view
activity_main.xml (for List view):
xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
activity_grid.xml (for Grid view):
xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="4" />

</RelativeLayout>
activity_image.xml (for Image view):
xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@drawable/your_image" />

</RelativeLayout>
Now, let's write the Java code for each activity:

MainActivity.java (for List view):


java
Copy code
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

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

ListView listView = findViewById(R.id.listView);

String[] items = {"Item 1", "Item 2", "Item 3", "Item 4",
"Item 5"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
}
}
GridActivity.java (for Grid view):
java
Copy code
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.GridView;

import androidx.appcompat.app.AppCompatActivity;

public class GridActivity extends AppCompatActivity {

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

GridView gridView = findViewById(R.id.gridView);

String[] items = {"Item 1", "Item 2", "Item 3", "Item 4",
"Item 5", "Item 6", "Item 7", "Item 8",
"Item 9", "Item 10", "Item 11", "Item 12",
"Item 13", "Item 14", "Item 15", "Item 16"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, items);
gridView.setAdapter(adapter);
}
}
ImageActivity.java (for Image view):
java
Copy code
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class ImageActivity extends AppCompatActivity {

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

3 Explain any four methods of Google Map


1. addCircle(CircleOptionsoptions) :This Method Adds circle to
the map
2. clear() : This method removes everything from the map.
3. stopAnimation(): This method stop the camera animation.
4. getMyLocation() : This method returns the currently displayed
user location.
5. setTrafficEnabled(Boolean enabled) : The method set the
traffic layer on or off.
6. AnimateCamera(camera Updateupdate) : This method moves
the map accordingly to the update with an animation.

4 Explain in details Content Provider & Fragments


Content provider is a component that interacts with a repository.
It supplies data from one application to others on request.
Such requests are handled by the methods of the contentResolver
Class

A content provider :

1. Separates data from the app interface code.


2. Provides standard way of accessing data.
3. Make it possible for apps to share data with other apps
4. Content Providers are good.
5. Content providers are useful for the apps.

Fragments are the modular section of an activity design. Fragments are


used to represent the behaviour of user interface in an activity.
We can build multiple fragments in an single activity.
And also use same fragments in the multiple activity.
Fragments has its own life cycle.
We can add or remove fragments in an activity while activity is running.
If we pause an activity all the fragments related to an activity will also
be stopped.
We can insert fragments into activity layouts by using <frgment>
element.

5 Explain any four methods of Location Class


getLatitude() : Get the latitude in degrees.
getLongitude() : Get the longitude in degress.
distanceTo(Location dest) : Provides the app distance in meters
between the location.
getAccuracy() : Get the istimated accuracy of this location in meters.
getSpeed(): Get the speed if available in meters/second over ground.
Reset() : Clears the content of the location.

You might also like