Android Development Tools

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

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.
The Activity Class 1.  One application component type  Provides a visual interface for a single screen  Typically supports one thing a user can do,
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
More on User Interface Android Applications. Layouts Linear Layout Relative Layout Table Layout Grid View Tab Layout List View.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
About me Yichuan Wang Android Basics Credit goes to Google and UMBC.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
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.
Rajab Davudov. Agenda Eclipse, ADT and Android SDK APK file Fundamentals – Activity – Service – Content Provider – Broadcast Receiver – Intent Hello World.
Mobile Application Development using Android Lecture 2.
CS378 - Mobile Computing Intents.
10/10/2015 E.R.Edwards 10/10/2015 Staffordshire University School of Computing Introduction to Android Overview of Android System Android Components Component.
CHAPTER TEN AUTHORING.
Overview of Android Application Development
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Android – Fragments L. Grewe.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
DKU-MUST Mobile ICT Education Center 10. Activity and Intent.
CS378 - Mobile Computing Audio.
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
CS371m - Mobile Computing Intents 1. Allow us to use applications and components that are already part of Android System – start activities – start services.
Introduction to Android Programming
Android Application -Architecture.
Mobile Applications (Android Programming)
Android Application Audio 1.
Mobile Applications (Android Programming)
Mobile Application Development BSCS-7 Lecture # 2
OPERATING SYSTEM CONCEPT AND PRACTISE
Activity and Fragment.
Broadcast receivers.
CS371m - Mobile Computing Services and Broadcast Receivers
Basic Activities and Intents
Instructor: Mazhar Hussain
Android Boot Camp for Developers Using Java, 3E
Activities, Fragments, and Events
Fragment ?.
Mobile Application Development BSCS-7 Lecture # 6
Mobile Applications (Android Programming)
Activities and Intents
Anatomy of an Android App and the App Lifecycle
Android Mobile Application Development
The Android Activity Lifecycle
ANDROID UI – FRAGMENTS UNIT II.
Android Application Development android.cs.uchicago.edu
Android Programming Lecture 9
CIS 470 Mobile App Development
Anatomy of an Android App and the App Lifecycle
Using K2 applications How can users interact with K2 applications?
Activity Lifecycle Fall 2012 CS2302: Programming Principles.
Application Development A Tutorial Driven Course
Android Topics Android Activity Lifecycle and Experiment Toast
Activities and Intents
Activities and Intents
HNDIT2417 Mobile Application Development
Programming Mobile Applications with Android
CIS 470 Mobile App Development
Activities and Intents
Emerging Platform#3 Android & Programming an App
Activities and Intents
Mobile Programming Dr. Mohsin Ali Memon.
SE4S701 Mobile Application Development
Activities and Fragments
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Android Development Tools

Android App Lifecycle Context Central command center for Android app The Context class, android.content.Context, fundamental building block of app Provides access to application-wide features, i.e., files, device resources, system-wide services Example: Context context = getApplicationContext( );

Android App Lifecycle Activity Android app is a collection of task, each called an activity Each activity has a unique task or purpose Activity class, android.app.Activity fundamental building block of any app Define & implement an Activity class for each screen in app Extends the Context class, so it has all of the functionality of Context class

Android App Lifecycle A simple game app might have following five activities: A startup or splash screen: primary entry point to app. Displays app name & version information. A main menu screen: acts as a switch to drive user to core activities of app. User chooses what they want to do with app A game play screen: where core game play occurs A high scores screen: display game scores or settings A help/about screen: displays information user might need to play the game

Android App Lifecycle Lifecycle of an Android Activity Android app can be multiprocess Multiple apps may run concurrently as long as memory processing power available Apps can have background behavior Apps can be interrupted and paused when phone call occurs Can be only one active app visible to user at a time OS keeps track of all Activity objects by putting them on a stack When a new Activity starts, the Activity on top of stack pauses & new Activity pushed onto top of stack Apps must manage their state & memory, resources, & data Pause & resume seamlessly

Android App Lifecycle

Android App Lifecycle onCreate( ) onResume( ) Single parameter, a Bundle, which is null if new Activity If restarting Activity, Bundle contains previous state information Perform any setup, such as layout & data binding in onCreate( ) onResume( ) When Activity reaches top of stack, onResume() starts Retrieve any instances to resources needed to run Appropriate place to start audio, video, & animations

Android App Lifecycle onPause( ) Current Activity is informed that it is being pushed down stack by way of onPause() method Should stop any audio, video, & animations started Deactivate resources such as database Cursor objects Last chance to clean up & release resources not need while in background Need to save uncommitted data System reserves right to kill an activity without further notice after onPause() is called Need to be timely because new foreground Activity is not started until the onPause() method returns

Android App Lifecycle Under low-memory conditions, Android OS can kill any Activity that has been paused, stopped, or destroyed. Any Activity not in foreground is subject to shutdown If Activity is killed after onPause(), the onStop() & onDestroy() methods will not be called Release resources in onPause() Killing Activity does not remove it from stack Activity state is saved into a Bundle object When user returns to Activity later, the onCreate() method is called again, this time with a valid Bundle object as the parameter

Android App Lifecycle onDestroy( ) Activity is destroyed in normal course of operation Activity has completed its lifecycle Activity is killed by Android OS because it needs resources, but still has time to gracefully destroy your Activity

Android App Lifecycle Fragment An activity can be componentized, each is called a fragment Each fragment has a unique task or purpose with parent activity Fragment class, android.app.Fragment Used to organize activity functionality for more flexible user experience across various screen sizes, orientations and aspect ratios Introduced in Android 3.0

Android App Lifecycle Consider MP3 music player applications that allows user to view list of artists, drill down to list their albums, drill down to see each track in an album, play a track.

Android App Lifecycle On a tablet or a television, you’re wasting a whole lot of space with one Activity per screen On a large enough screen, could implement a standard music library interface. Requires a single screen, single Activity class

Android App Lifecycle This could cause you to develop two separate applications: One to work on smaller screens One to work on larger screens Componentize your features and make four fragments, you can mix and match them on the fly Only one codebase to maintain

Android App Lifecycle Intent Android OS uses asynchronous messaging mechanism to match task request with the activity Each request is packaged as an intent Intent class, android.content.Intent Components such as activities & services communicate with one another

Android App Lifecycle startActivity (new Intent (getApplicationContext(), MyDrawActivity.class)); This example launches Activity named MyDrawActivity You can use the Intent structure to pass data between activities Intent object is composed of two main parts: The action to be performed The data to be acted upon You can also specify action/data pairs using Intent Action types and Uri objects

Android App Lifecycle Uri number = Uri.parse(tel:4445551212); Intent dial = new Intent(Intent.ACTION_DIAL, number); startActivity(dial); Activities defined with its own package Applications might launch external activities within other applications Ex: CRM application launches Contacts app to browse Contact database, choose contact, & return contact’s unique identifier to CRM

Android App Lifecycle There is a close relationship between activities and intents, and application navigation Application navigation: Main menu or list-style screen Drilldown list-style screen Click actions Options menu Action bar-style navigation

Android App Lifecycle Service Tasks that do not require user interaction can be encapsulated in a service A service is most useful when operations are lengthy or need to be done regularly Example: checking a server for new mail Service class, android.app.Service Handles background operations related to Android app Service class extends Context class

Android App Lifecycle When you might use a Service: A weather, email, or social network app to routinely check for updates on the network (polling) A game might create a service to download and process the content for the next level in advance of when the user needs it A photo or media app that keeps its data in sync online might implement a service to package and upload new content in the background when the device is idle