Android Unit 1
Android Unit 1
What is Android?
Android is a software package and linux based operating system for mobile devices such as tablet
computers and smartphones.
It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used
to write the android code even though other languages can be used.
The goal of android project is to create a successful real-world product that improves the mobile
experience for end users.
The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile devices. It
optimizes the virtual machine for memory, battery life and performance.
Dalvik is a name of a town in Iceland. The Dalvik VM was written by Dan Bornstein.
The Dex compiler converts the class files into the .dex file that run on the Dalvik VM. Multiple class
files are converted into one dex file.
The core building blocks or fundamental components of android are activities, views, intents,
services, content providers, fragments and AndroidManifest.xml.
Activity: An activity is a class that represents a single screen. It is like a Frame in AWT.
View: A view is the UI element such as button, label, text field etc. Anything that you see is a view.
Service: Service is a background process that can run for a long time. There are two types of
services local and remote. Local service is accessed from within the application whereas remote
service is accessed remotely from other applications running on the same device.
Fragment: Fragments are like parts of activity. An activity can display one or more fragments on
the screen at the same time.
Android Virtual Device (AVD): It is used to test the android application without the need for
mobile or tablet etc. It can be created in different configurations to emulate different types of real
devices.
Broadcast Receiver: They respond to broadcast messages from another application or system,
for example, a low battery message, or a no wifi connection message. They can respond to these
types of messages. They can receive messages from other apps. They have various types, such as
SMS broadcast receiver, Battery state, etc. You can create your own custom broadcast receiver.
Content Providers: This provides us access to data stored in our app or other apps safely. For
example, Whatsapp can access our contacts and numbers saved on the phone with content
providers.
UI components in android?
Views:
Sr.No. UI Control & Description
1 TextView
The AutoCompleteTextView is a view that is similar to EditText, except that it shows a list of
completion suggestions automatically while the user is typing.
5 ImageButton
An ImageButton is an AbsoluteLayout which enables you to specify the exact location of its
children. This shows a button with an image (instead of text) that can be pressed or clicked
by the user.
6 CheckBox
An on/off switch that can be toggled by the user. You should use check box when
presenting users with a group of selectable options that are not mutually exclusive.
7 ToggleButton
The ProgressBar view provides visual feedback about some ongoing tasks, such as when
you are performing a task in the background.
11 Spinner
A drop-down list that allows users to select one value from a set.
12 TimePicker
The TimePicker view enables users to select a time of the day, in either 24-hour mode or
AM/PM mode.
13 DatePicker
The properties of Android notification are set using NotificationCompat.Builder object. Some of
the notification properties are mention below:
Intents & filters: Android OS uses filters to pinpoint the set of Activities, Services, and
Broadcast receivers that can handle the Intent with help of specified set of action, categories, data
scheme associated with an Intent. You will use <intent-filter> element in the manifest file to list
down actions, categories and data types associated with any activity, service, or broadcast receiver.