0% found this document useful (0 votes)
16 views16 pages

MAD QB Solved

The document outlines various aspects of the Android operating system, including its features, development tools, and application structure. It details the components of the Android SDK, the directory structure of Android applications, and provides examples of XML layouts and Java code for basic functionalities. Additionally, it discusses the Open Handset Alliance (OHA) and various UI elements and attributes used in Android development.

Uploaded by

janhavic811
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)
16 views16 pages

MAD QB Solved

The document outlines various aspects of the Android operating system, including its features, development tools, and application structure. It details the components of the Android SDK, the directory structure of Android applications, and provides examples of XML layouts and Java code for basic functionalities. Additionally, it discusses the Open Handset Alliance (OHA) and various UI elements and attributes used in Android development.

Uploaded by

janhavic811
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/ 16

For 2 Marks

1. List features of Android operating system.


ANS
• Open source:Android is a powerful open source operating system which
provides a lot of great features like:
• It's an open source and we can customize the OS based on our requirements.
• Multi-tasking:It supports a multi-tasking, we can move from one task
window to another and multiple applications can run simultaneously.
• Reuse the application components:It will give a chance to reuse the
application components and the replacement of native applications.
• Multimedia:It has an extensive support for multimedia hardware control to
perform playback or recording using camera and microphone.
• Beautiful Ul:
• Android OS basic screen provides a beautiful and intuitive user interface.
• Multi-touch:
• Android has native support for multi-touch
• Wi-Fi Direct:
• A technology that lets apps discover and pair directly. over a high-bandwidth
peer-to-peer connection.
• Alternate Keyboards:
• Android supports multiple keyboards and makes them easy to install; the
SwiftKey, Skype and 8 pen apps all offer ways to quickly change up your
keyboard style

2. Write difference between JVM and DVM.


ANS
3. List all tools and software required for developing an android application.
ANS
Android Studio
Android SDK
Java Development Kit (JDK)
Gradle
Emulator (AVD)
XML Editor
Debugging tools (ADB - Android Debug Bridge)

4. Draw the hierarchical directory structure of android application.


ANS
5. Explain directory structure of android application.
ANS
1. manifests folder: This folder has the AndroidManifest.xml file inside. This file
contains the configuration parameters of the project such as permissions,
services and additional libraries. This is the Android application definition file.
It contains information about the Android application such as minimum
Android version, permission to access Android device capabilities such as
internet access permission, ability to use phone permission, etc.

2. java folder: The source code files written in Java programming language
reside in this folder. You can see that the java file of the activity named
"MainActivity.java" is automatically created in this folder.

3. res folder: The resource files are contained in this folder. Resources basically
mean all the needed files except the source code. The media, image and
layout files residing in the resources folder are accessed via Java code written
in MainActivity.java.
4. Some of the key files and directory(folders) are there ,Let's see each folder in
detail:
5. src - Java source files associated with your project.
6. res - Resource files associated with your project. All graphics, strings, layouts,
and other
7. resource files are stored in the resource file hierarchy under the res
directory.
8. res/layout - XML layout files that describe the views and layouts for each
activity and for partial views such as list items.
9. res/values - XML files which store various attribute values. These include
strings.xml, dimens.xml, styles.xml, colors.xml, themes.xml, and so on.
10. res/drawable - Here we store the various density-independent graphic assets
used in our application.
11. res/mipmap - most commonly used for application icons.
6. Define Emulator.
ANS
An Emulator is a device which mimics the functionality of an actual physical device
such as a smartphone
It allows you to test and debug applications without needing a physical device
• An Android Emulator is a device that simulates an Android device on your
system. Suppose we want to run our android application that we code. One
option is that we will run this on our Android Mobile by Enabling USB
Debugging on our mobile.

7. State how the APK files are built?


ANS
The source code is compiled into .class files.
The .class files are converted to Dalvik bytecode (.dex).
The .dex files and resources are packaged into an APK file.
The APK is signed and optimized for deployment.

8. Enlist the elements of UI.


ANS
 TextView
 EditText
 Button
 ImageView
 RecyclerView
 ToggleButton
 Spinner

9. Define OHA and state goal of OHA.


ANS
• In November 2007 Google formed OPEN HANDSET ALLIANCE(OHA) in
order to develop an open source software platform for use in mobile devices.
• The OHA was established on November 5, 2007, led by Google with 34
members,including mobile handset makers, application developers,
some mobile network operators and chip makers.
• Its goal is to develop open standards for mobile devices, promote innovation
in mobile phones and provide a better experience for consumers at a lower
cost.

10. List attributes of Linear Layout.


ANS
• android:id This is the ID which uniquely identifies the view.
• android:layout_width This is the width of the layout.
• android:layout_height This is the height of the layout
• android:layout_marginTop This is the extra space on the top side of the layout.
android:layout_marginBottom This is the extra space on the bottom side of the
layout.
• android:layout_marginLeft This is the extra space on the left side of the
layout.
• android:layout_marginRight This is the extra space on the right side of the
layout.
• android:layout_gravity This specifies how child Views are positioned.
• android:layout_weight This specifies how much of the extra space in the
layout should be allocated to the View.
• android:layout_x This specifies the x-coordinate of the layout.
• android:layout_y This specifies the y-coordinate of the layout.
• android:paddingLeft This is the left padding filled for the layout.
• android:paddingRight This is the right padding filled for the layout.
• android:paddingTop This is the top padding filled for the layout.
• android:paddingBottom This is the bottom padding filled for the layout

11. List attributes of AutocompleteTextiew.


ANS
android:completionThreshold
android:dropDownWidth
android:hint
android:inputType
12. List attributes of TextView.
ANS
android:textSize
android:textColor
android:textStyle
android:gravity
13. List attributes of Button.
ANS
android:text
android:background
android:onClick
android:textColor
14. List attributes of Toggle Button.
ANS
android:checked
android:textOn
android:textOff
android:background
For 4 Marks
15. List and explain attributes of Relative layout.
ANS
android:layout_centerHorizontal – Centers child elements horizontally.
android:layout_centerVertical – Centers child elements vertically.
android:layout_alignParentTop – Aligns child with parent top.
android:layout_toLeftOf – Positions child to the left of another element.
16. List and explain attributes of Table Layout.
ANS
17. Draw and Explain Android architecture in detail.
ANS
18. Write an xml file to create login page using Table layout.
ANS
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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" android:onClick="login"/>
</TableRow>

</TableLayout>
19. Develop a program to perform addition,subtraction,multiplication,Division of
Two numbers.
ANS
import android.os.Bundle;
import android.widget.*;
import androidx.appcompat.app.AppCompatActivity;

public class CalculatorActivity extends AppCompatActivity {


EditText num1, num2;
Button add, subtract, multiply, divide;
TextView result;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
num1 = findViewById(R.id.num1);
num2 = findViewById(R.id.num2);
add = findViewById(R.id.add);
subtract = findViewById(R.id.subtract);
multiply = findViewById(R.id.multiply);
divide = findViewById(R.id.divide);
result = findViewById(R.id.result);

add.setOnClickListener(v ->
result.setText(String.valueOf(Integer.parseInt(num1.getText().toString()) +
Integer.parseInt(num2.getText().toString()))));
subtract.setOnClickListener(v ->
result.setText(String.valueOf(Integer.parseInt(num1.getText().toString()) -
Integer.parseInt(num2.getText().toString()))));
multiply.setOnClickListener(v ->
result.setText(String.valueOf(Integer.parseInt(num1.getText().toString()) *
Integer.parseInt(num2.getText().toString()))));
divide.setOnClickListener(v ->
result.setText(String.valueOf(Integer.parseInt(num1.getText().toString()) /
Integer.parseInt(num2.getText().toString()))));
}
}

20. Write down steps to install android studio and android sdk.
ANS
1. Visit
https://developer.android.com/studio/install
to get the Android Studio executable or zip file.
2. Click on the Download Android Studio Button.
3. Click on the “I have read and agree with the above terms and conditions”
checkbox followed by the download button.
4.Select Android Virtual Device and click on Next >
5. It will show the installation path, default it could be in C:\Program Files\Android\,
If you want to change the installation directory, you can freely use the Browse
button and give the location and click on Next.
6. Click on Install.
7.Actual installation in progress..
8.Tick on Start Android Studio and Click on Finish.
• This is how, we can install Android Studio on windows 10.
• as we tick on Start Android Studio option, the Android Studio will launch
automatically as soon as we click on Finish button.
• Meanwhile, it will be finding the available SDK components.

10. It will ask for the Android Studio installation type. Mostly we can go with Standard setup, if
you have any specific configuration setup then you can select the Custom option to manual setup.
Now choose Standard Setup, and click on Next.

11.Now choose the theme, whether the Light theme or the Dark one. The light one is
called the IntelliJ theme whereas the dark theme is called Dracula. Choose as
required.
• Now it is time to download the SDK components.
12.It will download all necessary SDK components to launch the Android Studio and
setting up the environment.
13. After download and installation click on Finish.

21. Explain features of Android SDK.


ANS
Android SDK stands for Android Software Development Kit which is developed
by Google for Android Platform. With the help of Android SDK, we can create
android Apps easily.
Android SDK is a collection of libraries and Software Development tools that are
essential for Developing Android Applications.
Rich API for app development
Emulator support
Debugging and profiling tools
Support for multiple screen sizes
Pre-built UI components

• Android Developers Tool:


• Android Studio: Google’s official IDE for Android based on Intellij IDEA.
• Eclipse: This open source IDE is the second most popular in the world. It is
more than just an IDE for Java desktop apps!
Android Virtual Device:
• An Android Virtual Device (AVD) is an emulator configuration that allows
developers to test the application by simulating the real device capabilities.
An Android Virtual Device (AVD) is a configuration that defines the
characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive
OS device that you want to simulate in the Android Emulator

Android Emulator:
An Android emulator or an Android Virtual Device (AVD) is a software that
emulates Android OS and its functionality on your computer. Notably, it creates a
virtual representation of a phone or any other device. It then runs the Android
operating system as if it was running on a physical implementation of that device

22. Write a Program to place Name, Age and Mobile no. centrally on display screen
using Relative Layout.
ANS
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/nameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:"
android:textSize="18sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"/>

<EditText
android:id="@+id/nameInput"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@id/nameLabel"
android:layout_centerHorizontal="true"
android:hint="Enter Name"/>

<TextView
android:id="@+id/ageLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age:"
android:textSize="18sp"
android:layout_below="@id/nameInput"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"/>

<EditText
android:id="@+id/ageInput"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@id/ageLabel"
android:layout_centerHorizontal="true"
android:hint="Enter Age"
android:inputType="number"/>
<TextView
android:id="@+id/mobileLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile No:"
android:textSize="18sp"
android:layout_below="@id/ageInput"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"/>

<EditText
android:id="@+id/mobileInput"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@id/mobileLabel"
android:layout_centerHorizontal="true"
android:hint="Enter Mobile No"
android:inputType="phone"/>

</RelativeLayout>

JAVA CODE
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {


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

// Reference to UI elements
EditText nameInput = findViewById(R.id.nameInput);
EditText ageInput = findViewById(R.id.ageInput);
EditText mobileInput = findViewById(R.id.mobileInput);
}
}

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