0% found this document useful (0 votes)
32 views13 pages

Android Fundamentals Concepts

Views are the basic building blocks of Android user interfaces. There are several types of views including basic views, picker views, list views, and display views. Activities provide screens for user interaction and each activity has a lifecycle of states like created, started, resumed, and paused. Intents are messaging objects that facilitate communication between app components like starting activities and services. The AndroidManifest file describes app components and requirements.

Uploaded by

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

Android Fundamentals Concepts

Views are the basic building blocks of Android user interfaces. There are several types of views including basic views, picker views, list views, and display views. Activities provide screens for user interaction and each activity has a lifecycle of states like created, started, resumed, and paused. Intents are messaging objects that facilitate communication between app components like starting activities and services. The AndroidManifest file describes app components and requirements.

Uploaded by

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

Android - Fundamental

Concepts

1
Views

• The basic unit of the Android UI is the View.


• This class represents the basic building block for user interface components.
• Every item in a user interface is a subclass of the Android View class (to be
precise android.view.View).
• The Android SDK provides a set of pre-built views that can be used to
construct a user interface. Typical examples include standard items such as
the Button, CheckBox, ProgressBar and TextView classes.

2
Types of Views
• Basic Views - commonly-used views such as TextView, EditText, and
Button views
• Picker Views - views that allows users to select from, such as the
TimePicker and DatePicker views
• List Views - views that display a long list of items, such as the ListView
and the Spinner views
• Display Views - views that display images, such as the Gallery and
ImageSwitcher views
• Menus - views that displays additional and context sensitive menu
items
• Additional Views - interesting views such as the AnalogClock and
DigitalClock views 3
Activity

• an application component that provides a screen with which users


can interact in order to do something
• such as dial the phone, take a photo, send an email, or view a map.
• Each activity is given a window in which to draw its user interface.
• The window typically fills the screen, but may be smaller than the
screen and float on top of other windows.
• Typically, one activity in an application is specified as the "main"
activity, which is presented to the user when launching the
application for the first time.

4
Activity

• Each activity can then start another activity in order to perform


different actions.
• Each time a new activity starts, the previous activity is stopped, but
the system preserves the activity in a stack (the "back stack").
• When a new activity starts, it is pushed onto the back stack and
takes user focus.
• The back stack abides to the basic "last in, first out" stack
mechanism, so, when the user is done with the current activity and
presses the Back button, it is popped from the stack (and destroyed)
and the previous activity resumes

5
Activity

• When an activity is stopped because a new activity starts, it is notified of this change in state
through the activity's lifecycle callback methods.

• There are several callback methods that an activity might receive, due to a change in its state—
whether the system is creating it, stopping it, resuming it, or destroying it—and each callback
provides you the opportunity to perform specific work that's appropriate to that state change

• . For instance, when stopped, your activity should release any large objects, such as network or
database connections.

• When the activity resumes, you can reacquire the necessary resources and resume actions that were
interrupted.

• These state transitions are all part of the activity lifecycle.


6
Intents
• An intent is a messaging object you can use to request an action
from another application component.
• Although intents facilitate communication between components in
several ways, there are three fundamental use-cases:
• To start an activity
• To start a service
• To deliver a broadcast

7
Intents
• There are two types of intents:
• Explicit intents specify the component to start by name (the fully-
qualified class name). You'll typically use an explicit intent to start a
component in your own app, because you know the class name of the
activity or service you want to start. For example, start a new activity in
response to a user action or start a service to download a file in the
background.
• Implicit intents do not name a specific component, but instead declare a
general action to perform, which allows a component from another app
to handle it. For example, if you want to show the user a location on a
map, you can use an implicit intent to request that another capable app
show a specified location on a map.
8
Content Providers

• Content providers manage access to a structured set of data.


• Content providers are the standard interface that connects data in
one process with code running in another process.
• Android itself includes content providers that manage data such as
audio, video, images, and personal contact information.
• A content provider presents data to external applications as one or
more tables that are similar to the tables found in a relational
database.

9
Androidmanifest.xml
• Every application must have an AndroidManifest.xml file (with precisely that
name) in its root directory
• The manifest file presents essential information about your app to the Android
system i.e. information the system must have before it can run any of the app's
code
• It names the Java package for the application. The package name serves as a
unique identifier for the application.
• It describes the components of the application — the activities, services,
broadcast receivers, and content providers that the application is composed
of.
• It names the classes that implement each of the components and publishes
their capabilities. These declarations let the Android system know what the
components are and under what conditions they can be launched.
• It determines which processes will host application components.
10
Androidmanifest.xml

• It declares which permissions the application must have in


order to access protected parts of the API and interact with
other applications.
• It also declares the permissions that others are required to have
in order to interact with the application's components.
• It declares the minimum level of the Android API that the
application requires.
• It lists the libraries that the application must be linked against.

11
Androidmanifest.xml
• the most important items in an AndroidManifest.xml file are the activity elements.
• A single Android app can have many activities, and each activity must have its own activity element
in the app’s AndroidManifest.xmlfile.
• If you add an activity’s Java code to an Android application, you must also add an activity element
to the application’s AndroidManifest.xmlfile.
• If you forget to add an activity element, you see anActivityNotFoundException when you try to run
the application.
• Within an activity element, an intent-filter element describes the kinds of duties that this activity
can fulfill for apps on the same device.
• To give you an idea, the action android.intent.action.MAIN indicates that this activity’s code can be
the starting point of an app’s execution. And the
category android.intent.category.LAUNCHER indicates that this activity’s icon can appear on the
device’s Apps screen.

12
Other Core Components

• Service
• A service doesn't have a visual user interface, runs in the
background for a period of time
• Broadcast receivers
• a component that does nothing but receive and react to broadcast
announcements
• Content providers
• A content provider makes a specific set of the application's data
available to other applications.
• The data can be stored in the file system, in an SQLite database, or
in any other manner that makes sense
13

You might also like