Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Advertisements

Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Android architecture overview
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 Activity Class 1.  One application component type  Provides a visual interface for a single screen  Typically supports one thing a user can do,
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Android 101 Application Fundamentals January 29, 2010.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
Android Development (Basics)
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Android Application Development Tutorial. Topics Lecture 5 Overview Overview of Networking Programming Tutorial 2: Downloading from the Internet.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Android development the first app. Andoid vs iOS which is better? Short answer: neither Proponents on both sides For an iOS side, see this article on.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
CS5103 Software Engineering Lecture 08 Android Development II.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Mobile Computing Lecture#08 IntentFilters & BroadcastReceivers.
1 Mobile Computing Monetizing An App Copyright 2014 by Janson Industries.
Chapter 2: Simplify! The Android User Interface
DUE Hello World on the Android Platform.
CS378 - Mobile Computing Intents.
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
CE Applied Communications Technology Android lecture 2 - Structures Android File structure Resources Drawables Layout Values R Class Manifest Running.
Copyright© Jeffrey Jongko, Ateneo de Manila University Of Activities, Intents and Applications.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Overview of Android Application Development
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.
Android Boot Camp for Developers Using Java, 3E
Configuring Android Development Environment Nilesh Singh.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Android App Basics Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5.
Applications with Multiple Activities. Most applications will have more than one activity. The main activity is started when the application is started.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Android and s Ken Nguyen Clayton state University 2012.
TCS Internal Maps. 2 TCS Internal Objective Objective :  MAPS o Integration of Maps.
Lecture 2: Android Concepts
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Introduction to Android Programming
Android Programming.
Chapter 2: Simplify! The Android User Interface
Lab7 – Appendix.
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
Android Application Development 1 6 May 2018
Android N Amanquah.
GUI Programming Fundamentals
Android Introduction Hello World.
Activities and Intents
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
ITEC535 – Mobile Programming
תכנות ב android אליהו חלסצ'י.
CIS 470 Mobile App Development
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Activities and Intents
Activities and Intents
CIS 470 Mobile App Development
Android Notifications
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Application Fundamentals

See: developer.android.com/guide/developing/building/index.html

 By default, each application:  assigned a unique Linux user ID  executes in its own Linux process  By default, each process runs its own virtual machine  Android manages process creation & shutdown  Starts process when any of the application's code needs to be executed  Shuts down when process is no longer needed and system resources are required by other applications

 Apps can have multiple entry points  i.e., not just main() method  App comprise components that the system can instantiate and run as needed  Key component classes include:  Activities  Services  Broadcast receivers  Content providers

 Primary class for interacting with user  Usually implements a focused task  Usually Involves one screenful of data  Example:  Calculator

 Runs in the background to perform long- running or remote operations  Does not have a visual user interface  Example  Music playing application

 Components that listen for broadcast announcements (events)  Events implemented as Intent instances  Does not have a visual user interface  Example  Alarm manager

 Store & retrieve data across applications  Uses database-style interface  Example  Contacts

 MapLocation  User enters an address  App displays a map showing address

1. Define resources 2. Implement application classes 3. Package application 4. Install & run application

 Several types of resources can be defined  Layout  Strings  Images  Menus  etc.  See: developer.android.com/guide/topics/resources/index.html

 User interface layout specified in XML file  With Eclipse can also do layout visually  Stored in res/layout/filename.xml  Accessed from R.layout class

?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical” android:layout_width="fill_parent” android:layout_height="fill_parent” > <TextView android:layout_width="wrap_content” android:layout_height="wrap_content” android:text="Enter Location”/> <EditText android:layout_width="fill_parent” android:layout_height="wrap_content” /> <Button android:layout_width="wrap_content” android:layout_height="wrap_content” android:text="Show Map” />

 Types  String  String Array  Plurals  Can include style and formatting  Stored in res/values/filename.xml  Each string specified  Accessed as R.string.string_name

 At compilation time, resources are used to generate R.java  Applications access resources through R class

public final class R { public static final class attr { } public static final class id { public static final int location=0x7f040000; public static final int mapButton=0x7f040001; } public static final class layout { public static final int main=0x7f030000; }

 Usually involves at least one Activity  Initialization code usually in onCreate()  Restore saved state  Set content view  Initialize UI elements  Link UI elements to code actions  Set other Activity parameters as desired

public class MapLocation extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // restore saved state

public class MapLocation extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // restore saved state setContentView(R.layout.main); // set content view

public class MapLocation extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // restore saved state setContentView(R.layout.main); // set content view // initialize UI elements final EditText addressText = (EditText) findViewById(R.id.location); final Button button = (Button) findViewById(R.id.mapButton);

public class MapLocation extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // restore saved state setContentView(R.layout.main); // set content view // initialize UI elements final EditText addressText = (EditText) findViewById(R.id.location); final Button button = (Button) findViewById(R.id.mapButton); // link UI elements to code actions button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { try { String address = addressText.getText().toString(); address = address.replace(' ', '+'); Intent geoIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startActivity(geoIntent); } catch (Exception e) {}}}); }

 System packages application as a.apk file  Developers specify application information in AndroidManifest.xml

 Information includes:  Application Name  Components  Required permissions  Application features  Minimum API level  Other  See: developer.android.com/guide/topics/fundamentals.html#Manifest

?xml version="1.0" encoding="utf-8"?>

 Components can communicate by sending and receiving Intent events  From AndroidManifest.xml (intent filter)   Specifies that MapLocation Activity is entry point for the application & will appear in launcher  System sends this Intent to application when user clicks on application icon

 A chain of related Activities is called a task  The task’s Activity objects are stored on a stack with the currently running Activity at the top  At runtime  Newly started activities are pushed onto stack  Hitting the BACK button pops current activity off the stack  Gives the illusion that multiple, unrelated Activities were developed as part of the same application

 Android can pause or terminate individual components  For example when:  Task stack changes  Memory gets low  User stops interacting with the application  New application is launched  At these times, Android notifies applications by calling their lifecycle methods  Each component type has its own lifecycle  Will discuss more in later classes

 Using Eclipse  Create the MapLocation application  Add a text field showing the number of times the users has searched for any location during the current session