✅ 2 MARKS QUESTIONS
1. List any four features of Android operating system
• Storage
• Multitasking
• Web Browser
• Open Source
2. Define Emulator
An emulator is a software application that simulates a mobile device environment on
a computer, allowing developers to test and debug Android applications without using
a physical device.
3. List any four folders from directory structure of Android project and
elaborate in one line
• app: Contains manifest, java, and res folders.
• java: Contains all Java source code.
• res: Stores resources like layouts, drawables, etc.
• manifest: Contains the manifest file that defines essential information about the app.
4. Name two classes used to play audio and video in Android
• MediaPlayer
• MediaController
5. List attributes of Radio Button (Any four)
• id
• checked
• text
• textColor
6. List types of permissions in android / permissions in android app
development
• Normal permissions
• Dangerous permissions
• Signature permissions
• Special permissions
7. Define/Explain Geocoding and Reverse Geocoding
• Geocoding: Converting address to (latitude, longitude).
• Reverse Geocoding: Converting (latitude, longitude) into a human-readable address.
✅ 4 MARKS QUESTIONS
1. Compare JVM and DVM (any four points)
DVM (Dalvik Virtual Machine) JVM (Java Virtual Machine)
It is Register based which is designed to run on It is Stack based.
low memory.
DVM uses its own byte code and runs the JVM uses java byte code and runs “.class” file
“.Dex” file. From Android 2.2 SDK Dalvik has having JIT (Just In Time).
got a Just in Time compiler
DVM has been designed so that a device can A single instance of JVM is shared with
run multiple instances of the VM efficiently. multiple applications.
Applications are given their own instance.
DVM supports the Android operating system JVM supports multiple operating systems.
only.
There is a constant pool for every application. It has a constant pool for every class.
Here the executable is APK. Here the executable is JAR.
2. Explain Android Architecture with diagram
1. Applications
o Top layer with apps like Contacts, Music, Games, etc.
o Uses framework and runtime to run apps.
2. Application Framework
o Provides built-in classes and services to build apps.
o Services: Activity Manager, Telephony, Location, Notification, etc.
3. Android Runtime
o Contains DVM (Dalvik Virtual Machine) and Core Libraries.
o DVM runs apps efficiently and supports multithreading.
o Core Libraries let us code using Java.
4. Platform Libraries
o Libraries for SQLite, Webkit, SSL, OpenGL, Media, etc.
o Supports 2D/3D graphics, video/audio, web, and databases.
5. Linux Kernel
o Base layer of Android. Manages hardware via drivers.
o Handles memory, power, security, and device control.
3. Write steps to install and configure Android Studio.
1. Go to official site
Visit: https://developer.android.com/android-studio/download
2. Download Android Studio
Click on Download, accept terms, and save the file.
3. Start Installation
Open the downloaded file → click Next → select installation path → click Next.
4. Finish Installation
Click Finish after installation is complete.
5. Skip Import Settings
If prompted, choose “Don’t import settings” → click OK.
6. Start Android Studio
Android Studio will open and search for SDK components.
7. Choose Setup Options
Select Standard setup → choose theme (Light = IntelliJ, Dark = Darcula) → click
Next.
8. Download SDK Components
Click Finish to download SDK. Wait till all components are installed.
9. Start New Project
Click “Start a new Android Studio project” to begin building your app.
4. Draw and explain Activity Life Cycle
Ans
1. onCreate()
o Called when the activity is first created.
o Used to initialize UI components.
2. onStart()
o Called when the activity becomes visible to the user.
3. onResume()
o Activity is now in the foreground (user can interact).
o From here, the user can return after onPause().
4. onPause()
o Activity is still visible but partially hidden (e.g., a popup appears).
o Used to pause animations, videos, etc.
5. onStop()
o Activity is fully hidden or backgrounded.
o Used to save data/state.
6. onRestart()
o Called when returning from onStop() to restart the activity.
7. onDestroy()
o Called before activity is destroyed (e.g., user exits or system kills it).
5. Explain Android Security Model
1. Application Sandbox:
o Every app runs in its own space, so it can’t access data of other apps.
2. Permissions:
o Apps must ask user permission for sensitive actions like using camera,
contacts, location, etc.
3. Application Signing:
o Every app must be digitally signed by the developer for identity verification.
4. Secure Communication:
o Android uses HTTPS, SSL/TLS for secure data transfer over the internet.
5. User Control:
o Users can control and revoke permissions anytime from app settings.
6. Importance of Developer Console
● Google Play Developer Console is the platform that Google provides for Google Play
and Android developers to publish their apps.
● The Google Play Developer console allows app developers and marketers to better
understand how their apps are performing in terms of growth, technical performance such
as crashes or display issues, and financials.
● The console offers acquisition reports and detailed analysis which can help app devs
find out how well an app is really performing.
● The platform is important as it provides developers with access to first party data
(trustworthy information collected about an app’s audience that comes straight from
Google Play) that highlights the real performance of an app.
● It shows the number of impressions an app listing receives and the number of Installs
an app receives from different sources over time.
7. Explain Geocoding and Reverse Geocoding with example
1. Geocoding:
o It is the process of converting a place name or address into its latitude and
longitude.
o Example: "Gateway of India" → 18.9218, 72.8347
2. Reverse Geocoding:
o It is the process of converting latitude and longitude into a human-readable
address.
o Example: 19.0760, 72.8777 → "Mumbai, Maharashtra"
✅ 6 MARKS QUESTIONS
1. Program to capture image using camera and display it
MainActivity.java
public class MainActivity extends AppCompatActivity {
ImageView imageView;
Button photoBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = findViewById(R.id.image);
photoBtn = findViewById(R.id.photo);
photoBtn.setOnClickListener(v -> {
Intent camIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camIntent, 1);
});
}
@Override
protected void onActivityResult(int reqCode, int resCode, Intent data) {
super.onActivityResult(reqCode, resCode, data);
if (reqCode == 1 && resCode == RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}
}
2. App to send and receive SMS (XML + Java + manifest)
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:padding="16dp">
<EditText android:id="@+id/etPhone" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter number" />
<EditText android:id="@+id/etMsg" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter message" />
<Button android:id="@+id/btnSend" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Send SMS" />
</LinearLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
EditText etPhone, etMsg;
Button btnSend;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etPhone = findViewById(R.id.etPhone);
etMsg = findViewById(R.id.etMsg);
btnSend = findViewById(R.id.btnSend);
btnSend.setOnClickListener(v -> {
String number = etPhone.getText().toString();
String msg = etMsg.getText().toString();
SmsManager.getDefault().sendTextMessage(number, null, msg, null, null);
Toast.makeText(this, "SMS Sent", Toast.LENGTH_SHORT).show();
});
}
}
SmsReceiver.java
public class SmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
SmsMessage sms = SmsMessage.createFromPdu((byte[]) pdus[0]);
String msg = sms.getMessageBody();
Toast.makeText(context, "Received: " + msg, Toast.LENGTH_LONG).show();
}
}
}
AndroidManifest.xml
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application ...>
<receiver android:name=".SmsReceiver" android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
3. App to display Google Map / current location
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
MainActivity.java
public class MainActivity extends FragmentActivity implements OnMapReadyCallback {
FusedLocationProviderClient locationProvider;
GoogleMap gMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationProvider = LocationServices.getFusedLocationProviderClient(this);
SupportMapFragment mapFragment = (SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
gMap = googleMap;
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
return;
}
gMap.setMyLocationEnabled(true);
locationProvider.getLastLocation().addOnSuccessListener(location -> {
if (location != null) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
gMap.addMarker(new MarkerOptions().position(latLng).title("You are here"));
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
}
});
}
}
AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application ...>
<!-- Add your Google Maps API key inside meta-data -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY_HERE" />
</application>
4. Steps for deploying app on Play Store
• Step 1: Make a Developer Account
• Step 2: Plan to Sell? Link Your Merchant Account
• Step 3: Create an App
• Step 4: Prepare Store Listing
• Step 5: Upload APK to an App Release
• Step 6: Provide an Appropriate Content Rating
• Step 7: Set Up Pricing & Distribution
• Step 8: Rollout Release to Publish Your App
1. Create Developer Account
o Sign up using a Google Account.
o Pay $25 one-time fee. Approval may take up to 48 hours.
2. Link Merchant Account (if needed)
o Required for paid apps or in-app purchases.
o Helps manage sales and payouts.
3. Create Your App
o Click on “Create Application”.
o Select default language and app title.
4. Prepare Store Listing
o Add app details (title, description, screenshots, icons).
o Add category, contact info, and privacy policy (if needed).
5. Upload APK and Create Release
o Upload your APK file.
o Choose release type (internal, open test, or production).
6. Set Content Rating
o Fill rating questionnaire.
o Avoid “Unrated” to prevent app removal.
7. Set Pricing & Distribution
o Choose free or paid option.
o Select countries for release.
8. Rollout and Publish App
o Review all sections (listing, rating, pricing).
o Click on “Confirm Rollout” to publish your app.
5. Text to Speech Conversion
Activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:padding="16dp">
<EditText android:id="@+id/inputText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter text to speak" />
<Button android:id="@+id/speakBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Speak" />
</LinearLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
EditText inputText;
Button speakBtn;
TextToSpeech tts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
inputText = findViewById(R.id.inputText);
speakBtn = findViewById(R.id.speakBtn);
tts = new TextToSpeech(this, status -> {
if (status != TextToSpeech.ERROR)
tts.setLanguage(Locale.ENGLISH);
});
speakBtn.setOnClickListener(v -> {
String text = inputText.getText().toString();
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null, null);
});
}
@Override
protected void onDestroy() {
if (tts != null) {
tts.stop();
tts.shutdown();
}
super.onDestroy();
}
}
6. Student Registration / Feedback App with SQLite
Activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:padding="16dp">
<EditText android:id="@+id/etName" android:hint="Enter Name"
android:layout_width="match_parent" android:layout_height="wrap_content"/>
<EditText android:id="@+id/etFeedback" android:hint="Enter Feedback"
android:layout_width="match_parent" android:layout_height="wrap_content"/>
<Button android:id="@+id/btnSave" android:text="Save"
android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
EditText etName, etFeedback;
Button btnSave;
SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etName = findViewById(R.id.etName);
etFeedback = findViewById(R.id.etFeedback);
btnSave = findViewById(R.id.btnSave);
db = openOrCreateDatabase("StudentDB", MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS Feedback(Name TEXT, Comment
TEXT)");
btnSave.setOnClickListener(v -> {
String name = etName.getText().toString();
String comment = etFeedback.getText().toString();
db.execSQL("INSERT INTO Feedback VALUES('" + name + "', '" + comment +
"')");
Toast.makeText(this, "Saved!", Toast.LENGTH_SHORT).show();
});
}
}