You are on page 1of 16

Introduction to Android

In 2007, a group of handset manufacturers, wireless carriers,


and software developers (notably, Google) formed the Open
Handset Alliance, with the goal of developing the next
generation of wireless platform. Unlike existing platforms, this
new platform would be
nonproprietary and based on open standards, which would
lead to lower development .
• If there’s one time when “cheap and easy” is a
benefit, it’s with mobile development. Wireless
application development, with its ridiculously
expensive compilers and preferential developer
programs, has been notoriously expensive to
break into com
pared to desktop development. Here, Android
breaks the proprietary mold. Unlike with other
mobile platforms, there are virtually no costs to
developing Android applications.
What is API level?
• API Level is an integer value that uniquely
identifies the framework API revision offered
by a version of the Android platform.
Platform Version API Level VERSION_CODE

Android 6.0 23 MARSHMALLOW

Android 5.1 22 LOLLIPOP_MR1

Android 5.0 21 LOLLIPOP

Android 4.4W 20 KITKAT_WATCH KitKat for We

Android 4.4 19 KITKAT

Android 4.3 18 JELLY_BEAN_MR2

Android 4.2, 4.2.2 17 JELLY_BEAN_MR1

Android 4.1, 4.1.1 16 JELLY_BEAN

Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR


1
Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH

Android 3.2 13 HONEYCOMB_MR2

Android 3.1.x 12 HONEYCOMB_MR1

Android 3.0.x 11 HONEYCOMB


Android 3.0.x 11 HONEYCOMB

Android 2.3.4 10 GINGERBREAD_MR1


Android 2.3.3

Android 2.3.2 9 GINGERBREAD


Android 2.3.1
Android 2.3

Android 2.2.x 8 FROYO

Android 2.1.x 7 ECLAIR_MR1

Android 2.0.1 6 ECLAIR_0_1

Android 2.0 5 ECLAIR

Android 1.6 4 DONUT

Android 1.5 3 CUPCAKE

Android 1.1 2 BASE_1_1

Android 1.0 1 BASE


Android application structure
1. User interface layer
• The role of the UI is to display the application data
on the screen and also to serve as the primary
point of user interaction. Whenever the data
changes, either due to user interaction (like
pressing a button) or external input (like a network
response), the UI should update to reflect those
changes. Effectively, the UI is a visual
representation of the application state as retrieved
from the data layer.
• 2. The domain layer
• is an optional layer that sits between the UI
layer and the data layer.
• The domain layer is responsible for encapsulating complex business logic,
or simple business logic that is reused by multiple ViewModels. This layer
is optional because not all apps will have these requirements. You should
only use it when needed-for example, to handle complexity or favor
reusability.
• A domain layer provides the following benefits:
• It avoids code duplication.
• It improves readability in classes that use domain layer classes.
• It improves the testability of the app.
• It avoids large classes by allowing you to split responsibilities.
To keep these classes simple and lightweight, each use case should only have
responsibility over a single functionality, and they should not contain mutable
data. You should instead handle mutable data in your UI or data layers.
3. Data layer
• the data layer contains application
data and business logic. The business logic is
what gives value to your app—it's made of
real-world business rules that determine how
application data must be created, stored, and
changed.
The data layer is made of repositories that each can contain zero to many data sources. You should create a repository
class for each different type of data you handle in your app. For example, you might create a MoviesRepository class for data r
elated to movies, or a PaymentsRepository class for data related to payments.
Android UI architecture

• application context
– The Context tells us about the surrounding information.
– It is very important to understand the environment which we want to understand.
– Ex. Usually, the app got multiple screens like display/inquiry/add/delete screens(A general requirement
of a basic app). So when the user is searching for something, the Context is an inquiry screen in this case.
Application context vs activity context
• Intent
– Android Intent is the message that is passed between components such as activities, content providers,
broadcast receivers, services etc.
• Android intents are mainly used to:
– Start the service
– Launch an activity
– Display a web page
– Display a list of contacts
– Broadcast a message
– Dial a phone call etc.
• Types of Android Intents
• There are two types of intents in android: implicit and explicit.
• 1) Implicit Intent
• Implicit Intent doesn't specifiy the component. In such case, intent provides
information of available components provided by the system that is to be invoked.
• For example, you may write the following code to view the webpage.
• Intent intent=new Intent(Intent.ACTION_VIEW);
• intent.setData(Uri.parse("http://www.javatpoint.com"));
• startActivity(intent);
• 2) Explicit Intent
• Explicit Intent specifies the component. In such case, intent provides the external
class to be invoked.
• Intent i = new Intent(getApplicationContext(), ActivityTwo.class);
• startActivity(i);
activity lifecycle
Method Description

onCreate called when activity is first created.

onStart called when activity is becoming


visible to the user.
onResume called when activity will start
interacting with the user.
onPause called when activity is not visible to
the user.
onStop called when activity is no longer
visible to the user.
onRestart called after your activity is stopped,
prior to start.
onDestroy called before the activity is
destroyed.
UI Components

• View lab1 widget doc file

You might also like