MAD MID 1 2M Ans

You might also like

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

MOBILE APPLICATION DEVELOPMET

MID-1 COMMON TO CSE, CSE-AI, CSE-IOT


UNIT -1 (2MARKS)

1. Define an emulator.
A) An emulator is a hardware device or software program that enables one computer system
(also known as a host) to imitate the functions of another computer system (known as the
guest). It enables the host system to run software, tools, peripheral devices and other
components which are designed for the guest system
Emulators are usually composed of three components:

• CPU emulator (the most complex part)


• Memory sub-system emulator
• Different input/output device emulators

2. What is an Activity and Intent?


A) Activity: In an Android app, an Activity is like a page on your screen. Each Activity
shows something different, like a chat screen or a settings page.
Intent: An Intent is like a message that says what you want to do. For example, you
might send an Intent to open a new page (Activity) or to share something with another
app. It's a way for different parts of the app to talk to each other.

3. What is DVM?
A) In simple terms, DVM stands for "Dalvik Virtual Machine." It's a software engine in
Android devices that runs apps. You can think of it as a kind of interpreter for apps
written in Java. It takes the code written by developers and executes it on your phone
or tablet, allowing you to use different apps smoothly.

4. What is the role of view group? Explain.


A) A View Group in Android is essentially a layout container that holds and organizes
other views, such as buttons, text fields, images, etc., within the user interface. Its
primary role is to manage the layout and positioning of its child views, determining
how they are displayed on the screen.

Here are some key roles and responsibilities of a View Group:


i)Layout Management
ii)Size Control
iii)Event Handling
iv)View Hierarchy Management
v)Customization and Extensibility

5)What is an APK file?


A) An APK (Android Package Kit) file is like a ZIP file for Android apps. It contains
all the necessary files needed to install and run an app on an Android device, such as
code, images, and resources. It contains all the elements necessary for an Android app
to be installed and run on a device, including the compiled code files (such as .dex
files), resources, assets, and manifest file, which provides essential information about
the app, such as its name, version, permissions, and required hardware features.

UNIT-2 (2 MARKS)

1. List some Commonly Used Layouts?


A)
• LinearLayout: Arranges its children views either vertically or horizontally in a
single direction.
• RelativeLayout: Positions its children relative to each other or to the parent
layout.
• ConstraintLayout: A flexible layout manager that allows you to create large and
complex layouts with a flat view hierarchy. It uses constraints to define the
position and size of views relative to each other.
• FrameLayout: Places its children on top of each other, with only the last child
being visible. It's often used for simple container layouts or for overlapping
views.
• GridLayout: Arranges its children in a grid-like fashion, with specified number
of rows and columns.
• CoordinatorLayout: A powerful layout that allows for coordinating the
animations and transitions of its child views. It's often used in conjunction with
the AppBarLayout and FloatingActionButton for creating Material Design-
style interfaces.
• ConstraintSet: While not a layout in itself, ConstraintSet is used in conjunction
with ConstraintLayout to dynamically define layout constraints
programmatically rather than in XML.
2. Write a code snippet to display a Toast Notification.
A)
import android.content.Context;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Display a short toast message
showToast("Hello, world!");
}
// Method to display a toast message
private void showToast(String message) {
// Create a Toast object
Toast.makeText(getApplicationContext(),message,
Toast.LENGTH_SHORT).show();
}
}

3) What are the different types of Event handlers?


A)
• OnClickListener: Handles click events on views such as buttons, images, or any
other clickable view.
• OnLongClickListener: Similar to OnClickListener, but handles long-click
events on views.
• OnTouchListener: Handles touch events like touch down, touch up, and touch
move on views.
• OnFocusChangeListener: Handles focus change events when a view gains or
loses focus.
• TextWatcher: Monitors changes to the text in an EditText view, providing
callbacks when the text is changed, before it's changed, or after it's changed.
• SeekBar.OnSeekBarChangeListener: Handles changes to the position of a
SeekBar, providing callbacks when the progress changes.
• AdapterView.OnItemClickListener: Handles item click events in AdapterView
(such as ListView or GridView).
• AdapterView.OnItemSelectedListener: Handles item selection events in
AdapterView.
• GestureDetector.OnGestureListener: Detects gestures such as swipes, taps, and
scrolls.
• BroadcastReceiver: Handles system-wide broadcast events such as incoming
SMS, battery low, network state changes, etc.

4)Differentiate Text View and Edit Text Controls.

A) TextView:

• Display Only: TextView is used for displaying text content on the screen. It's
generally used to show static text that the user cannot modify.
• Read-Only: Text displayed in a TextView is read-only, meaning the user
cannot interact with it directly.
• No User Input: TextView does not allow the user to input text directly. It's
used to present information to the user.
• Styling: TextView supports various text styling attributes such as color, size,
font, alignment, etc.
EditText:

• Input Field: EditText is used for accepting user input as text. It provides a
field where users can type text input.
• Editable: Unlike TextView, EditText allows users to modify the text content
directly by typing, deleting, or editing the text.
• User Interaction: Users can interact with EditText to input, edit, or delete text.
It's commonly used in forms, search bars, chat applications, etc.
• Input Handling: EditText provides methods and listeners to handle text input
events, such as text changes, focus changes, keyboard actions, etc.
• Text Attributes: Similar to TextView, EditText also supports text styling
attributes for controlling the appearance of the input text.

5) What are different Widgets available in Android?


A)
• App Widgets: Small apps you can put on your home screen, like weather or
clock widgets.
• System Widgets: Built-in widgets provided by Android, such as the date and
time display or battery status.
• Custom Widgets: Widgets created by developers for their apps, offering
unique functionality or information.
• List View Widgets: These widgets display a scrollable list of items, such as
emails, messages, or news articles, directly on the home screen.
• Grid View Widgets: Similar to list view widgets, these widgets display items
in a grid layout on the home screen.
• Stack View Widgets: Introduced in Android 4.0 (API level 14), stack view
widgets allow users to scroll through a collection of views, typically images
or cards, on the home screen.

You might also like