0% found this document useful (0 votes)
4 views

MC Unit 2 Notes

Ok
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

MC Unit 2 Notes

Ok
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1 CTH EDUCATION

Unit – 02 : Creating first android application.


 Anatomy of android application,
 Deploying Android app on USB connected Android device.
 Android application components, Activity life cycle.
 Understanding activities,
 Exploring Intent objects, Intent Types,
 Linking activities using intents.

Questions to be discussed:
1. What is Android? Write the features of android.
2. Explain in brief components of android application.
3. Discuss about activity life cycle.
4. What is intent? Also explain its type.
5. Write short notes on :
a. Anatomy of an android application
b. Linking activities using intents.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
2 CTH EDUCATION
What is Android?
 Android is an open source and Linux-based OS for mobile devices.
 Android was developed by the Open Handset Alliance, led by Google.
 The first beta version of the Android Software Development Kit (SDK) was released
by Google in 2007 where as the first commercial version, Android 1.0,
was released in September 2008.
 On June 27, 2012, Google announced the next Android version, 4.1 Jelly Bean.
 Jelly Bean is an incremental update, with the primary aim of improving the user interface, both in terms
of functionality and performance.
 The source code for Android is available under free and open source software licenses.

Features of Android :
 Beautiful UI : Android OS basic screen provides a beautiful and intuitive user interface.
 Connectivity : GSM/EDGE, CDMA, UMTS, Bluetooth, Wi-Fi, LTE, NFC and WiMAX.
 Storage : SQLite, a lightweight relational database, is used for data storage purposes.
 Media support : H.263, H.264, MPEG-4, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1, MP3, MIDI, WAV,
JPEG, PNG, GIF, and BMP.
 Messaging : SMS and MMS :
 Multi-tasking : User can jump from one task to another and same time various application can run
simultaneously.
 Wi-Fi Direct : A technology that lets apps discover and pair directly, over a high-bandwidth peer-to-
peer connection.

History of Android:
 Initially, Andy Rubin founded Android Incorporation at California, United States in October, 2003.
 Originally intended for camera but shifted to smart phones later because of low market for camera.
 The key employees are Andy Rubin, Rich Miner, Chris White and Nick Sears.
 Android is the nick name of Andy Rubin given by coworkers because of his love to robots.
 In 17th August 2005, Google acquired android Incorporation.
 In 2007, Google announces the development of android OS.
 In 2008, first android mobile launched HTC Dream(T-mobile G1).
 The code names of android ranges from A to M currently, such as Aestro, Blender, Cupcake, Donut,
Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch, Jelly Bean, KitKat, Lollipop and
Marshmallow.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
3 CTH EDUCATION
What is anatomy in android application?
 The anatomy is the structure of android application.
 It explores the needs of the mobile app user.
 The structure of android contains :
 Src
 Android library
 Gen
 Assets
 Res
 AndroidManifest.xml

src :
 Src contains .java source files for your project.
 In this example, there is one file, MainActivity.java.
 The MainActivity.java file is the source file for your activity.
 You will write the code for your application in this file.

Android 3.0 library :


 This item contains one file, android.jar, which contains
all the class libraries needed for an Android application.

gen :
 Contains the R.java file, a compiler-generated file that references all the resources found in your project.
 You should not modify this file.

assets :
 This folder contains all the assets used by your application, such as HTML, text files, databases, etc.

res :
 This folder contains all the resources used in your application.

AndroidManifest.xml :
 Here you specify the permissions needed by your application, as well as other features.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
4 CTH EDUCATION
Components of android application:
1. Activities
2. Services
3. Content Providers
4. Broadcast Receivers

Activity:
 Every single activity on screen with the help of UI is called activity.
 An android application is a collection of task and each task is called an activity.
 Each activity within an application has a unique task or purpose.
 They dictate the UI and handle the user interaction to the smart phone screen.
 Activities are said to be the presentation layer of our applications.
 Each activity is completely isolated from each other.

Services:
 They handle background processing associated with an application.
 Services are like invisible workers of our app.
 These components runs in background, updating your activities, triggering Notification, and also
broadcast Intents.
 They also perform some tasks when applications are not active.

Content Providers
 They handle data and database management issues.
 They are also responsible for sharing the data beyond the application boundaries.
 The Content Providers of a particular application can be configured to allow access from other
applications, and the Content Providers exposed by other applications can also be configured.
 A content provider should be a sub-class of the class Content Provider.

Broadcast Receivers
 These components are used for user alert.
 It can used status bar for notification.
 They are known to be intent listeners.
 Broadcast Receivers make our application react to any received Intent.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
5 CTH EDUCATION
Activity life cycle:
 In android java file is called activity.
 An Android activity goes through for stages:
1. Does not exist
2. Foreground stage
3. Background stage
4. Pause
 These activities life cycle having 6 methods:
 onCreate()
 onStart()
 onResume()
 onPause()
 onStop(), and
 onDestroy().

What is Intents?
 The intent is a messaging object which tells what kind of action to be performed.
 They are extensively used throughout Android.
 It is an object used to request an action from another app component via the Android system.
 Intents can be used to start and stop Activities and Services.
 The process of taking users from one application to another is achieved by passing the Intent.
 Intents, in general, are used for navigating among various activities within the same application, or
they can be moving from one application to another as well.

What can intents do?


1. Start activities
 A button click starts a new activity for text entry
 Clicking Share opens an app that allows you to post a photo
2. Start services
 Initiate downloading a file in the background
1. Deliver broadcasts
 The system informs everybody that the phone is now charging

Types of Android Intents


 There are two types of intents in android
1. Implicit
2. Explicit

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
6 CTH EDUCATION
Implicit Intent
 Implicit Intent doesn’t specify the component.
 Implicit Intent states the action to be performed.
 It is not responsible for calling specific in-app components.
 For example, if the user wants to see a location on a map, we can use an Implicit Intent to switch to
another app that displays a specific location on a map.

Explicit Intent
 Explicit Intent specifies the component.
 Explicit Intent is used to invoke a specific target component.
 It is used to switch from one activity to another in the same application.
 For example, we can use an explicit intent to start a new activity when the user invokes an action or
plays music in the background.

Explicit and implicit intents


1. Explicit Intent
 Starts a specific activity
 Request tea with milk delivered by Nikita
 Main activity starts the ViewShoppingCart activity

2. Implicit Intent
 Asks system to find an activity that can handle this request
 Find an open store that sells green tea
 Clicking Share opens a chooser with a list of apps

Linking activity using intent:


 An intent is a description of an operation to be performed.
 An Intent is an object used to request an action from another app component via the Android system.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)

You might also like