Professional Documents
Culture Documents
Question Bank PT1-MAD-22-23-CO-IF
Question Bank PT1-MAD-22-23-CO-IF
Question Bank PT1-MAD-22-23-CO-IF
Sub.Code:22617
2 Marks Questions
ANS:
Beautiful UI
Storage
Multi-touch
Android has native support for multi-touch which was initially made available in
handsets such as the HTC Hero.
Messaging
Web browser
Based on the open-source layout engine, coupled with Chrome's V8 JavaScript engine
supporting HTML5 and CSS3 it provides different browser support.
Media support
Android supports the following audio/video/still media formats: H.263, H.264, MPEG-4
SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1, MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF,
and BMP.
android:layout_alignParentTop
android:layout_alignParentBottom
android:layout_alignParentLeft
android:layout_alignParentRight
android:layout_alignTop
android:layout_alignBottom
android:layout_alignLeft
android:layout_alignRight
ANS: Open Handset Alliance (OHA) was formed in November 2007. The OHA is the group
that is in charge of Android smartphones operating system. It was created by Google. The
OHA is business alliance that consists of 47 companies for developing open standard
platform for mobile devices. Now the firms had increased from 80 to 84. The members of
OHA include handset manufactures, chip makers, commercialization companies, software
companies and mobile operators.
7. Define Emulator.
ANS
Emulator:
The Android Emulator simulates Android devices on your computer so that you can test
your application on a variety of devices and Android API levels without needing to have
each physical device. The emulator provides almost all of the capabilities of a real Android
device. It lets you prototype, develop and test Android applications without using a physical
device.
ANS Android Development Tools (ADT) is a plug in for the Android studio that is designed
to give you a powerful integrated environment to build Android applications.
ADT extends the capabilities of Android studio to let you quickly set up new Android
projects, create an application UI, add components based on the Android framework API,
debug your application using the Android SDK tools and even export signed (or unsigned)
APK’s in order to distribute your application. Developing in android studio with ADT is
highly recommended and is the fastest way to get started with the guided project setup, it
provides, as well as tools integration, custom XML editors and debug output pane, ADT gives
you an incredible boost in developing Android applications.
android:id
1
This is the ID which uniquely identifies the layout.
android:baselineAligned
2 This must be a boolean value, either "true" or "false" and prevents the layout from
aligning its children's baselines.
android:baselineAlignedChildIndex
3 When a linear layout is part of another layout that is baseline aligned, it can specify
which of its children to baseline align.
android:divider
4 This is drawable to use as a vertical divider between buttons. You use a color value, in
the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
android:gravity
This specifies how an object should position its content, on both the X and Y axes.
5
Possible values are top, bottom, left, right, center, center_vertical, center_horizontal
etc.
android:orientation
6 This specifies the direction of arrangement and you will use "horizontal" for a row,
"vertical" for a column. The default is horizontal.
android:weightSum
7
Sum up of child weight
ANS: These three are called as Layout Parameters. They are used by sub-views to tell the
parent view how they want to be laid on the Activity screen i.e we can set the Horizontal
and Vertical size of a view using Layout Parameters.
match_parent: When you set layout width and height as match_parent, it will occupy
the complete area that the parent view has, i.e. it will be as big as the parent.
Note : If parent is applied a padding then that space would not be included.
wrap_content: If you set layout width or height as wrap_content it will use space big
enough for its contents to get enclosed.
ANS: An Android Toast is a small message displayed on the screen, similar to a tool tip or other
similar popup notification. A Toast is displayed on top of the main content of an activity, and
only remains visible for a short time period.
ANS: android:ems or setEms(n) sets the width of a TextView to fit a text of ‘N’ letters regardless
of the actual text extension and text size.
An Android Virtual Device (AVD) is an emulator configuration that allows developers to test the
application by simulating the real device capabilities. We can configure the AVD by specifying
the hardware and software options. AVD manager enables an easy way of creating and
managing the AVD with its graphical interface. We can create as many AVDs as we need, based
on the types of device we want to test for.
ANS:
15. List folders from directory structure of Android project and elaborate any
2 in short.
1)app: The App folder contains three subfolders (manifests, java and res) that make
up our application. They are divided so that it should be fairly easy to determine
which resources go in which folder.
3)Java: This is the folder in our project where we will be storing all of the source
code files written in Java programming language.
4)res: It contains folders that help us to separate and sort the resources of our
application. Resources basically mean all the needed files except the source code.
5)drawable: The drawable folder contains graphics that can be drawn to the screen.
6)layout: The layout folder contains XML files used for your layouts. These file are
used to set up the layout for your Activity and is used for basic alignment of your
layouts, components, widgets, and similar resources that are used for the UI of your
application.
7)mipmap : The mipmap folder contains the launcher icon files for the app. A
launcher icon is a graphic that represents your app to users.
8)values: The values folder contains XML files that contain simple values, such as
strings, integers, and colors. The values folder is used to keep track of the values we
will be using in our application.
activity_main refers to the activity_main. xml file located in the res/layout folder. The
onCreate() method is one of many methods that are figured when an activity is loaded.
A string resource provides text strings for your application with optional text styling and
formatting.
In Android, an XML-based layout is a file that defines the different widgets to be used in the UI
and the relations between those widgets and their containers. Android treats the layout files as
resources. Hence the layouts are kept in the folder res layout.
4 Marks Questions
2) Native Libraries
On the top of linux kernel, there are Native libraries such as WebKit,
OpenGL, FreeType, SQLite, Media, C runtime library (libc) etc.
The WebKit library is responsible for browser support, SQLite is for database,
FreeType for font support, Media for playing and recording audio and video
formats.
3) Android Runtime
In android runtime, there are core libraries and DVM (Dalvik Virtual
Machine) which is responsible to run android application. DVM is like
JVM but it is optimized for mobile devices. It consumes less memory and
provides fast performance.
4) Android Framework
5) Applications
On the top of android framework, there are applications. All applications such
as home, contact, settings, games, browsers are using android framework that
uses android runtime and libraries. Android runtime and native libraries are
using linux kernal.
2 runs the “.Dex” file. From JVM uses java byte code and runs “.class”file
Android 2.2 SDK Dalvik has gota having JIT (Just In Time).
Just in Time compiler
In android, TextView is a user interface control which is used to set and display the text to
the user based on our requirements. The TextView control will act as like label control and it
won’t allow users to edit the text.
In android, EditText is a user interface control which is used to allow the user to enter or
modify the text. While using EditText control in our android applications, we need to specify
the type of data the text field can accept using inputType attribute.
android:autoLink It will automatically found and convert urls and email addresses as a
clickable links.
android: ems It is used to make the textview be exactly this many ems wide.
android:gravity It is used to specify how to align the text by the view's x and y axis.
android:maxWidth It is used to make the TextView be at most this many pixels wide.
android:minWidth It is used to make the TextView be at least this many pixels wide.
android:typeface It is used to specify the Typeface (normal, sans, serif, monospace) for
the text.
android:inputType It is used to specify the type of text being placed in a text fields.
TextView
In android, TextView is a user interface control which is used to set and display
the text to the user based on our requirements. The TextView control will act as
like label control and it won’t allow users to edit the text.
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="Welcome to Thakur Polytechnic"
android:textColor="#86AD33"
android:textSize="20dp"
android:textStyle="bold" />
EditText
In android, EditText is a user interface control which is used to allow the user to
enter or modify the text. While using EditText control in our android
applications, we need to specify the type of data the text field can accept
using inputType attribute.
<EditText
android:id="@+id/txtSub"
android:layout_width="match_parent"
6. Explain the steps to install and configure Android studio and SDK
Step 1) Download Android Studio
You can download Android Studio from developer.android.com homepage
and search for downloads. Choose appropriate platform either for
windows, mac or linux
Step 2) Run .exe file
1. Now the next step is to launch .exe file you just download.
2. Click next and select Android SDK checked if you don’t have it
already. Make sure Android virtual device is also checked.
4. Next step is to set location of installation. Please make sure your disk
has minimum required space before clicking on Next. For Android
Studio installation location must have at least 500MB free space. For
Android SDK installation, selected location must have at least 3.25GB
free space.
5. Next step is to choose the start menu folder, where you want to create
shortcut. If
you don’t want to create a shortcut just mark Do not create shortcut.
2. If you don’t have any previous settings click on the second option
(I don’t have a previous version of Studio or I don’t want to
import my settings).
Download the latest version of Android Studio from above URL and launch
Android Studio.exe file by double clicking on it.
The initial android studio setup screen will open in that click Next to continue for
further steps of environment setup
Now we need to select a required components to setup an android environment.
Here we selected all three components (Android Studio, Android SDK and
Android Virtual Device) and click Next.
Now we need to agree the License agreements to proceed further, click on I
Agree button
Now we need to specify the local machine drive location to install Android Studio
and Android SDK. After selecting the location path to install required
components, click Next.
Now select the start menu folder to create a shortcut for android studio and click
Install
7. State syntax to create Text View and Image button with any two attributes
of each.
ANS:
Text View:
Syntax :
<TextView
android:id="@+id/textView1"
android:layout_width="<width value>”
android:layout_height="<height_value>"
android:text="<text to be displayed>"/>
Attributes/Properties of TextView:
View.findViewByID() or Activity.findViewById()
● auto link: Controls whether links such as urls and email addresses are automatically
found and converted to clickable links.[flag]
● gravity: The gravity attribute is an optional attribute which is used to control the
alignment of the text like left, right, center, top, bottom, center_vertical,
center_horizontal etc
● text: text attribute is used to set the text in a text view. We can set the text in xml as
well as in the java class.
● textColor: textColor attribute is used to set the text color of a text view. Color value is
in the form of “#argb”, “#rgb”, “#rrggbb”, or “#aarrggbb”.
● textSize: textSize attribute is used to set the size of text of a text view. We can set the
text size in sp(scale independent pixel) or dp(density pixel).
● textStyle: textStyle attribute is used to set the text style of a text view. The possible
text styles are bold, italic and normal. If we need to use two or more styles for a text
view then “|” operator is used for that.
● padding: padding attribute is used to set the padding from left, right, top or bottom.
ImageButton:
Syntax :
<ImageButton
android:id="@+id/imageButton"
android:layout_width="<width value>"
android:layout_height="<height value>"
● id: id is an attribute used to uniquely identify a image button. Below is the example
code in which we set the id of a image button.
● src: src is an attribute used to set a source file of image or you can say image in your
image button to make your layout look attractive.
● padding: padding attribute is used to set the padding from left, right, top or bottom of
the ImageButton.
Note: All the programs from Experiment 4 to 6 are part of Question Bank.