[go: up one dir, main page]

0% found this document useful (0 votes)
3 views4 pages

Android

An Android application consists of key components including Activities, Services, Broadcast Receivers, Content Providers, and the Application Class, each serving specific purposes in app functionality. Broadcast Receivers specifically respond to system-wide announcements and can handle both system and custom broadcasts. Android architecture is structured into layers: Linux Kernel, Hardware Abstraction Layer, Android Runtime & Libraries, Application Framework, and Applications.

Uploaded by

Error
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)
3 views4 pages

Android

An Android application consists of key components including Activities, Services, Broadcast Receivers, Content Providers, and the Application Class, each serving specific purposes in app functionality. Broadcast Receivers specifically respond to system-wide announcements and can handle both system and custom broadcasts. Android architecture is structured into layers: Linux Kernel, Hardware Abstraction Layer, Android Runtime & Libraries, Application Framework, and Applications.

Uploaded by

Error
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/ 4

Q.list and explain components of an Q.What is boardcast receiver?

Explain in detail
android application ? A Broadcast Receiver is a component in Android
An Android application is made up of several that allows an application to listen for system-
key components, each with a specific purpose A Broadcast Receiver is a component in Android
and lifecycle. These components interact to that allows an application to listen for system
deliver the app’s functionality. Here's a list wide broadcast announcements or messages
of the main components of an Android app, from other apps. These broadcasts are messages
along with explanations that can be sent by the Android system or other
1.Activities :- Purpose: Represent a single applications, and apps can register to receive them
screen with a user interface (UI). and react accordingly.
Example: A login screen or a settings page. 1.Purpose:- Respond to system-wide events
2. Services :- Purpose: Perform background (like battery low, screen off, boot completed, etc.)
operations without a user interface 2. Types of Broadcasts:-
Example: Playing music in the background, There are mainly two types:
downloading files, or syncing data. System Broadcasts: Sent by the Android system
3. Broadcast Receivers:- Purpose: Respond (e.g., when the device is charging, network
to system-wide broadcast announcements. connectivity changes, screen turns on/off, etc.)
Example: Battery low alert, screen turned off, Custom Broadcasts: Sent by applications
or app-specific broadcasts themselves to communicate events to other
4. Content Providers:- Purpose: Manage and components or apps.
share application data. Use Cases of Broadcast Receivers
Example: Accessing contacts, images, or files 1.Listening for changes in connectivity (Wi-Fi or
stored by other apps. mobile data)2. Responding to SMS received
5. Application Class:- Purpose: Base class for 3. Monitoring battery levels 4. Starting tasks after
maintaining global application state. the device boots 5. Custom app-wide notifications/
Example: Initializing libraries, maintaining a events
singleton pattern, or global variables.

Q. what is android architecture ? Q. What is the difference between BitmapDrawable


Android architecture refers to the structured and ShapeDrawable?
layout and components that make up the BitmapDrawable:-
Android operating system. It’s typically divided Purpose: Draws a bitmap image (like PNG, JPG, etc.).
Four main layers, Into four main layers, Source: It wraps around a Bitmap object or an image
1.Linux Kernel:- Acts as hardware abstraction resource. Use case:- when you want to display an
Layer. Image as-is
2. Hardware Abstraction Layer (HAL) EXAMPLE :- itmap bitmap = BitmapFactory.
Interfaces between hardware and higher-level decodeResource(getResources(),
system APIs. R.drawable.my_image);
3. Android Runtime (ART) & Libraries ShapeDrawable :-
ART (Android Runtime): What it draws: A geometric shape (rectangle, oval, line
Executes apps using Ahead-of-Time (AOT) and ring).
Just-in-Time (JIT) compilation Use case: When you want to draw simple shapes with
4. Application Framework .solid colors or gradients
Provides high-level APIs for app developers. Source: Defined programmatically or via XML shape
5. Applications:- Top layer where users interact. (shape drawable)..
Includes: Pre-installed apps (phone, messages, EXAMPLE:- drawable.getPaint().setColor(Color.RED);
camera)
Third-party apps installed via Play Store

Q.What are the different types of meanu In Q. how do you creat a dialog in andriod ?
Android ? This is the most common and easiest way to show
In Android, there are several types of menus a simple dialog.
that you can use to provide options to the Kotlin Example:-
user. Each serves a different purpose and val builder = AlertDialog.Builder(this)
appears in a different way. Here's a builder.setTitle("Dialog Title")
breakdown of the main types: builder.setMessage("This is the dialog message.")
1.option meanu builder.setPositiveButton("OK") { dialog, _ ->
Used for global actions like search, settings. dialog.dismiss()
Etc. 2.context meanu:- Used for global actions }
like search, settings, etc. 3.popup meanu builder.setNegativeButton("Cancel") { dialog, _ ->
appears when the user performs a long-press dialog.dismiss()
on a view. 4.submeanu:- A nested menu that }
appears within another menu. val dialog = builder.create()
5.bootom navigation meanu dallog show()
Appears at the bottom of the screen
6.navigation drawer meanu :-
Used for main navigation options.
7.toolbar meanu:- Often overlaps with the
options menu, but more modern and flexible.
Q. what is data bulding in android ? Q. What the different types of layout
Data building" in Android isn't a standard layout in android ?
or commonly used term, so its meaning In Android development, layouts are used
can vary depending on context. However to define the visual structure of a user
here are a few possibilities of what it interface. Here are the main types
could mean. 1 Building Data Models of layouts: 1.LinearLayout:- Orientation.
In app development, "building data" can be horizontal or vertical.
often refers to constructing data 2 RelativeLayout;- Good for complex
models—classes that represent data layouts with fewer nesting levels.
entities (like User, Product, Message, etc.) 3 ConstraintLayout:- Highly flexible and
2. Building Data for UI:- Example: powerful layout. 4. FrameLayout:-
Formatting or combining data for a. Designed to display a single view.
RecyclerView adapter. 3. Using the 5. TableLayout:- Each row is a
Builder Pattern for Data:- Sometimes, TableRow object 6. GridLayout:-
a Builder pattern is used to construct More modern alternative to TableLayout.
complex data objects step-by-step 7. CoordinatorLayout:- Works well with.
4. Data Binding:- You might be referring AppBarLayout, Toolbar, etc
to Data Binding in Android, which 8. ConstraintLayout:- Used for
connects your UI components to data building rich motion and UI animations.
sources in your app.

Q. what is the purpose of the drawable Q.what is spinner in android ?


class in android ? In Android, a Spinner is a UI element that
In Android, the Drawable class is a base provides a dropdown menu from which
class for anything that can be drawn to the user can select a single item. It’s
the screen. It provides a common like a combination of a button and a list
interface for different types of graphic — when the user taps the spinner, it
elements, such as shapes, images, and shows a list of options to choose from.
custom drawings. 1.Main Purposes of example use case :-
Drawable:- Abstract Drawing: It defines Let’s say you want the user to select their
a standard way to draw content to a country or a category — a spinner is perfect
Canvas regardless of the source for that.
(bitmap, shape, XML, etc.).
2.Reusability:- You can use the same
Drawable in different places Q.what is purpose of of listview ?
(e.g., ImageViews, Buttons, backgrounds) The purpose of a ListView is to display a
without duplicating the image or shape . scrollable list of items in a structured, vertical
3.Resource Management:- It can be layout. It's commonly used in apps or user
defined in XML (res/drawable/) or code, interfaces where you need to show a
making it easier to manage app assets collection of similar data, such as messages,
and UI components. 4. State Management contacts , emails, or settings options
: It can change appearance based on state
(pressed, focused, etc.), like with
StateListDrawable. 5.Animation Support:
Subclasses like AnimationDrawable
support frame-by-frame animations.

.
.
.

You might also like