Android Life Cycle CS328 Dick Steflik. Life Cycle The steps that an application goes through from starting to finishing Slightly different than normal.

Slides:



Advertisements
Similar presentations
Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Advertisements

CSE2102 Introduction to Software Engineering Lab 2 Sept/4/2013.
Android 02: Activities David Meredith
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
Android activities 1 CS300. What makes an app?  Activities: presentation layer  Services: invisible workers  Content Providers: databases  Intents:
Manifest File, Intents, and Multiple Activities. Manifest File.
The Activity Class 1.  One application component type  Provides a visual interface for a single screen  Typically supports one thing a user can do,
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Android 101 Application Fundamentals January 29, 2010.
More on User Interface Android Applications. Layouts Linear Layout Relative Layout Table Layout Grid View Tab Layout List View.
Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Getting Started with Android Development Rohit Ghatol.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
Android Mobile computing for the rest of us.* *Prepare to be sued by Apple.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Android Info mostly based on Pro Android 3.  User Applications  Java Libraries – most of Java standard edition ◦ Activities/Services ◦ UI/Graphics/View.
CS378 - Mobile Computing Intents.
Activities and Intents. Activities Activity is a window that contains the user interface of your application,typically an application has one or more.
Copyright© Jeffrey Jongko, Ateneo de Manila University Of Activities, Intents and Applications.
ANDROID – TESTING L. Grewe. With the AndroidStudio IDE.
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml.
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Noname. Conceptual Parts States of Activities Active Pause Stop Inactive.
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
J.BHAVANA 3/4B.TECH CSE Ch.Rochasmathi 3/4B.tech CSE.
INTRODUCTION TO ANDROID. Slide 2 Introduction I take a top-down approach to describing an application’s anatomy.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Putting together the AndroidManifest.xml file Creating multiple.
Android Programming.
Cosc 4735 Nougat API 24+ additions.
Introduction to android
Android Application -Architecture.
Mobile Applications (Android Programming)
Android Introduction Hello World
Mobile Application Development BSCS-7 Lecture # 2
Android Application Development 1 6 May 2018
Activity and Fragment.
Activities, Fragments, and Events
Mobile Application Development BSCS-7 Lecture # 6
Android Introduction Hello World.
XML Mihail L. Sichitiu.
MAD.
Activities and Intents
Anatomy of an Android App and the App Lifecycle
Android Mobile Application Development
The Android Activity Lifecycle
Mobile Device Development
Anatomy of an Android Application
CIS 470 Mobile App Development
Anatomy of an Android App and the App Lifecycle
Activity Lifecycle Fall 2012 CS2302: Programming Principles.
Android Topics Android Activity Lifecycle and Experiment Toast
HNDIT2417 Mobile Application Development
CIS 470 Mobile App Development
Activity Lifecycle.
Activities and Intents
Activities and Intents
SE4S701 Mobile Application Development
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Android Life Cycle CS328 Dick Steflik

Life Cycle The steps that an application goes through from starting to finishing Slightly different than normal Java life cycle due to : – the difference in the way Android application are defined – the limited resources of the Android hardware platform

Android Applications Applications are defined to Android via the android manifest file, located in the root of the Eclipse project definition (AndroidManifest.xml) Double clicking on the AndroidManifest.xml file in the Eclipse project will open the Manifest editor. The manifest editor is the normal way of creating and modifying the manifest file (defining the app to the system)

Android Applications An Android application is a collection of activities, an activity correlates to a screen or form that is presented to the user. The HelloAndroid is a simple one screen app that is essentially the same as a Java app run in a terminal/command window. Its AndroidManisest.xml file reflects this :

AndroidManifest.xml <manifest xmlns:android=" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0"> <activity android:name=".HelloAndroid"

The manifest tag has the following attributes: – xmlns ; the name of the namespace (android) and where the DTD for the xml parser is located – package ; the name of the java package for this application (must have at least two levels) – android:version ; the version code for this version of the app – android:versionName ; The version name (for publishing)

child tag of need one tag for each activity of the application attributes: – android:name; the name of the activity, this will be used as the name of the Java file and the resulting class – android:label; a string that we will be able to programatically retrieve the activity name at run time.

Child tag of First, what’s an intent? In OO-speak an intent is a message sent from one program to another (message dispatcher) to tell the system what to do next. Typically an intent consists of two parts; an action and the data that that action is supposed to use to do it. When you select an icon on the main page the intent is to run the app associated with that icon The tag is used to construct an android.content.IntentFilter object to handle a particular android.content.Intent

child of the action we want done: – Predefined actions of the intent class of android.content ; see the api at:

child of additional attributes that can be supplied LAUNCHER – indicates that it should apper in the launcher as a top level application see the api documentation for more on intent resolution.

Intents Commonly used Google application intents Registry of 3 rd party application Intents

Whew! we’ve explained the HelloAndroid manifest file, on to Life Cycle and Life cycle management.

Life Cycle Each application runs in its own process. Each activity of an app is run in the apps process Processes are started and stopped as needed to run an apps components. Processes may be killed to reclaim needed resources. Killed apps may be restored to their last state when requested by the user

Management Most management of the life cycle is done automatically by the system via the activity stack. The activity class has the following method callbacks to help you manage the app: – onCreate() – onStart() – onResume() – onPause() – onStop() – onRestart() – onDestroy()

using the callbacks To use a callback just overload it in your activity java file. The lifecycle is explained very well here: The use of the callbacks is explained in the api documentation for the activity class: