0% found this document useful (0 votes)
22 views8 pages

MAD Prelim Answers

The document outlines key features of the Android Operating System, including its open-source nature, multitasking support, and integration with Google services. It describes the Android ecosystem, architecture, and various UI layouts, as well as the roles of components like Emulators, Fragments, and Services. Additionally, it provides examples of Android applications, including SMS functionality, geocoding, and user interface elements, along with steps for app publishing and development.

Uploaded by

milee1722
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

MAD Prelim Answers

The document outlines key features of the Android Operating System, including its open-source nature, multitasking support, and integration with Google services. It describes the Android ecosystem, architecture, and various UI layouts, as well as the roles of components like Emulators, Fragments, and Services. Additionally, it provides examples of Android applications, including SMS functionality, geocoding, and user interface elements, along with steps for app publishing and development.

Uploaded by

milee1722
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1 Attempt any FIVE

a) List any four features of Android Operating System:


1. Open Source Platform: Android is based on the Linux kernel and is open
source, which means developers can access its source code and modify it as
needed to build custom ROMs or unique applications.
2. Multitasking Support: Android allows multiple applications to run
simultaneously. This enables users to listen to music while browsing the web
or receive notifications while watching videos.
3. Customizable User Interface: Android provides a highly flexible and
customizable UI. Users and developers can personalize widgets, themes,
launchers, and UI components.
4. Integration with Google Services: Android provides built-in support for
Google services like Gmail, Maps, Google Drive, Google Assistant, and Play
Store, enhancing usability and connectivity.

b) Explain the Android Ecosystem: The Android Ecosystem refers to the


comprehensive and interconnected system that supports the Android operating
system. It includes:
 Android OS: The base operating system for mobile devices.
 Google Services: APIs like Google Maps, Firebase, Play Services, etc., that
support app development.
 Google Play Store: The official marketplace for distributing Android apps.
 Hardware Devices: Smartphones, tablets, smartwatches, and smart TVs
manufactured by companies like Samsung, OnePlus, Xiaomi, etc.
 Developers and Tools: Includes Android Studio, SDKs, NDKs, and a global
developer community contributing to innovation.

c) List various layouts used in Android UI design:


1. LinearLayout: Aligns child views in a single direction - either vertically or
horizontally.
2. RelativeLayout: Allows positioning of child views relative to each other or the
parent container.
3. ConstraintLayout: A flexible layout that lets you position and size widgets in
a flat view hierarchy using constraints.
4. TableLayout: Organizes its children into rows and columns like a table.
5. FrameLayout: Designed to block out an area on the screen to display a single
item.
6. GridLayout: Places views in a rectangular grid.
d) Describe the role of Emulator: An Android Emulator simulates an Android device
on a computer. It provides an environment to test and run Android applications
without requiring a physical device. The emulator mimics various hardware and
software features such as phone calls, text messages, location services, battery
state, and more. It supports different screen sizes, Android versions, and system
images, making it an essential tool for developers during development and testing
phases.

e) Define: i) Fragment: A Fragment represents a reusable portion of the user


interface in an Android activity. It has its own lifecycle and can be combined with
other fragments within a single activity to create a multi-pane UI. Fragments
promote modular and reusable code.
ii) Service: A Service is an Android component that performs long-running
operations in the background without a user interface. Services can run indefinitely
and are used for tasks such as playing music, handling network transactions, or
interacting with content providers. Examples include foreground services for media
playback or background services for syncing data.

f) List attributes of RadioButton:


1. android:id: Specifies the ID for the RadioButton.
2. android:text: Defines the text to be displayed.
3. android:checked: Specifies the default checked state.
4. android:buttonTint: Sets the color of the RadioButton.
5. android:layout_width and android:layout_height: Defines dimensions.
6. android:textColor: Specifies the color of the text label.

g) Define SMS service in Android Application Development: The SMS service in


Android allows applications to send and receive text messages programmatically.
Using the SmsManager class, developers can send SMS messages directly from
within the app. Receiving SMS messages involves setting up a BroadcastReceiver to
listen for incoming messages.
Q.2 Attempt any THREE
a) Compare JVM and DVM:
Feature JVM DVM
Execution Executes .class files Executes .dex files
Architecture Stack-based Register-based
Optimization For desktop For mobile devices
Language Java Java (converted to dex)
Performance Higher overhead Optimized for low memory

b) Describe Android Architecture: Android architecture is structured in layers:


1. Linux Kernel: Provides core system services like security, memory
management, process management, and hardware drivers.
2. Libraries: Includes a set of C/C++ libraries used by various components of the
Android system.
3. Android Runtime (ART): Includes core libraries and the ART virtual machine
used to run applications.
4. Application Framework: Provides APIs for high-level services such as
telephony, location, resource management.
5. Applications: Topmost layer where native and third-party apps reside.

c) Describe directory structure and its components:


 manifests/: Contains AndroidManifest.xml file that defines app components,
permissions, and metadata.
 java/: Contains all Java/Kotlin source code files for activities, services,
broadcast receivers.
 res/: Includes subfolders like layout (UI XML files), drawable (images), values
(strings, styles), and mipmap (icons).
 Gradle Scripts: Holds build.gradle files which manage dependencies, build
types, and versioning.
d) Draw and explain Activity Life Cycle: The Activity life cycle consists of the
following methods:
1. onCreate(): Called when the activity is first created.
2. onStart(): Called when the activity becomes visible.
3. onResume(): Called when the activity starts interacting with the user.
4. onPause(): Called when the system is about to resume another activity.
5. onStop(): Called when the activity is no longer visible.
6. onRestart(): Called after the activity has been stopped.
7. onDestroy(): Called before the activity is destroyed.
Q.3 Attempt any THREE
a) Write XML to create login page using TableLayout:
<TableLayout>
<TableRow>
<TextView android:text="Username" />
<EditText android:id="@+id/username" />
</TableRow>
<TableRow>
<TextView android:text="Password" />
<EditText android:id="@+id/password" android:inputType="textPassword" />
</TableRow>
<TableRow>
<Button android:text="Login" />
</TableRow>
</TableLayout>

b) Steps for publishing Android app:


1. Create signed APK or AAB.
2. Register for a Google Play Developer Account.
3. Create an app listing in Google Play Console.
4. Upload APK/AAB and complete content rating.
5. Add screenshots, description, and app details.
6. Submit for review and publish.
c) Text to Speech in Android: Text-to-speech (TTS) enables Android devices to speak
text aloud.
TextToSpeech tts = new TextToSpeech(context, status -> {
if (status == TextToSpeech.SUCCESS) {
tts.setLanguage(Locale.US);
tts.speak("Hello World", TextToSpeech.QUEUE_FLUSH, null, null);
}
});
TTS is used in reading content aloud, navigation apps, or accessibility features.

d) DatePicker example:
DatePickerDialog datePickerDialog = new DatePickerDialog(this, (view, year, month,
day) -> {
dateTextView.setText(day + "/" + (month + 1) + "/" + year);
}, year, month, day);

datePickerDialog.show();

Q.4 Attempt any FOUR


a) Steps to install Android Studio:
1. Download the Android Studio installer from the official Android developer
website.
2. Launch the installer and follow the setup wizard instructions.
3. Install necessary SDK packages and tools.
4. Configure the Android Virtual Device (AVD) for emulator testing.
5. Open Android Studio and start a new project or import an existing one.

b) Develop an Android application to enter one number and display factorial:


 UI: One EditText for input, a Button to calculate, and a TextView for result.
 Logic:
int num = Integer.parseInt(editText.getText().toString());
int fact = 1;
for(int i = 1; i <= num; i++) {
fact *= i;
}
textView.setText("Factorial: " + fact);
)
c) Explain Geocoding and Reverse Geocoding with example:
Geocoding: Converts address into geographical coordinates.
Reverse Geocoding: Converts coordinates into readable address.

Geocoder geocoder = new Geocoder(this, Locale.getDefault());


List<Address> addresses = geocoder.getFromLocation(lat, lon, 1);
String address = addresses.get(0).getAddressLine(0);

d) Program to show checkboxes and display selected ones using Toast:

<LinearLayout>
<CheckBox android:id="@+id/cb1" android:text="Option 1"/>
<CheckBox android:id="@+id/cb2" android:text="Option 2"/>
...
<Button android:onClick="showSelected" android:text="Submit"/>
</LinearLayout>

public void showSelected(View view) {


String result = "";
if(cb1.isChecked()) result += "Option 1 ";
if(cb2.isChecked()) result += "Option 2 ";
Toast.makeText(this, result, Toast.LENGTH_SHORT).show();
}

Q.5 Attempt any TWO

a) Explain GridView and ImageView with example:


GridView: Used to display items in a two-dimensional scrollable grid.
ImageView: Displays image resources.
<GridView android:id="@+id/gridView" ... />
GridView grid = findViewById(R.id.gridView);
grid.setAdapter(new ImageAdapter(this));
b) Develop an app to send SMS:

<uses-permission android:name="android.permission.SEND_SMS" />

SmsManager sms = SmsManager.getDefault();


sms.sendTextMessage(phoneNo, null, message, null, null);

c) Program for Bluetooth connectivity:


Enable Bluetooth
Discover devices
Connect and transfer data

BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();


if (!bluetooth.isEnabled()) {
Intent enableBt = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBt, REQUEST_ENABLE_BT);
}

Q.6 Attempt any TWO

a) Store and retrieve student data using SQLite:

SQLiteDatabase db = openOrCreateDatabase("StudentDB", MODE_PRIVATE, null);


db.execSQL("CREATE TABLE IF NOT EXISTS student(rollno INT, name TEXT, marks
INT);");
db.execSQL("INSERT INTO student VALUES(1, 'John', 85);");
Cursor c = db.rawQuery("SELECT * FROM student WHERE rollno=1", null);

b) Program to show user's current location:

FusedLocationProviderClient locationClient =
LocationServices.getFusedLocationProviderClient(this);
locationClient.getLastLocation().addOnSuccessListener(location -> {
double lat = location.getLatitude();
double lon = location.getLongitude();
});
c) Program to send email:
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"example@mail.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "Subject");
email.putExtra(Intent.EXTRA_TEXT, "Body");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose Email Client"));

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy