Android Intents Nasrullah. Using the application context You use the application context to access settings and resources shared across multiple activity.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

CE881: Mobile and Social Application Programming Simon M. Lucas Quiz, Walkthrough, Exercise, Lifecycles, Intents.
Programming with Android: Activities and Intents Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Programming with Android: Activities and Intents Luca Bedogni Marco Di Felice Dipartimento di Informatica – Scienza e Ingegneria Università di Bologna.
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.
Intents.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Review of Java Applets Vijayan Sugumaran Decision and Information Sciences Oakland University.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 14 Applets, Images,
Mobile Programming Pertemuan 6 Presented by Mulyono Poltek NSC Surabaya.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L05 (Chapter 16) Applets.
Intent An Intent describes the operation to be performed. Intents are used to start an activity using either of the following methods – Context.startActivity()
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Presented by…. Group 2 1. Programming language 2Introduction.
Better reference the original webpage :
Introducing the Sudoku Example
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
DUE Hello World on the Android Platform.
CS378 - Mobile Computing Intents.
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.
Android Boot Camp for Developers Using Java, 3E
COMP 365 Android Development.  Every android application has a manifest file called AndroidManifest.xml  Found in the Project folder  Contains critical.
Chapter 10: Applets and Advanced Graphics The Applet Class The Applet Class The HTML Tag The HTML Tag Passing Parameters to Applets Passing Parameters.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Cosc 5/4730 Android Communications Intents, callbacks, and setters.
Linking Activities using Intents How to navigate between Android Activities 1Linking Activities using Intents.
Jsp (Java Server Page) Is a server side program.
Chapter 10: Applets and Advanced Graphics The Applet Class The Applet Class The HTML Tag The HTML Tag Passing Parameters to Applets Passing Parameters.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Applications with Multiple Activities. Most applications will have more than one activity. The main activity is started when the application is started.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Creating multiple views Introduction to intents Passing data to.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Introducing Intents Intents Bind application components and navigate between them Transform device into collection of interconnected systems Creating a.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Activities and Intents Richard S. Stansbury 2015.
Intents 1 CS440. Intents  Message passing mechanism  Most common uses:  starting an Activity (open an , contact, etc.)  starting an Activity.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Lecture 2: Android Concepts
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Putting together the AndroidManifest.xml file Creating multiple.
Editing a Twitter search. Viewing search results in a browser.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
CS371m - Mobile Computing Intents 1. Allow us to use applications and components that are already part of Android System – start activities – start services.
Android Mobile Application Development
Lecture 2: Android Concepts
Mobile Applications (Android Programming)
Linking Activities using Intents
Activities and Intents
Activities and Intents
Android Topics What are Intents? Implicit Intents vs. Explicit Intents
Objects First with Java
Activities and Intents
Lecture 2: Android Concepts
Mobile Programming Dr. Mohsin Ali Memon.
Android Development Tools
Activities, Fragments, and Intents
Presentation transcript:

Android Intents Nasrullah

Using the application context You use the application context to access settings and resources shared across multiple activity instances. You can retrieve the application context for the current process by using the getApplicationContext() method, like this: Context context = getApplicationContext(); Retreiving the applicatio resources String greeting = getResources().getString(R.string.hello);

Launching the activity There are a number of ways to launch an activity, including the following: 1.. Designating a launch activity in the manifest file 2.. Launching an activity using the application context 3.. Launching a child activity from a parent activity for a result

Launch activity in the manifestfile Each Android application must designate a default activity within the Androidmanifest file.

Launching Activity using Application Context The most common way to launch an activity is to use the startActivity() method of the application context. This method takes one parameter, called an Intent The following code calls the startActivity() method with an explicit intent: startActivity(new Intent(getApplicationContext(), MenuActivity.class));

This intent requests the launch of the target activity, named MenuActivity, by its class. This class must be implemented elsewhere within the package. Because the MenuActivity class is defined within this application’s package, it must be registered as an activity within the Android manifest file.

Intent to launch the web browser with specific url Uri address = Uri.parse(“ Intent surf = new Intent(Intent.ACTION_VIEW, address); startActivity(surf);

This example shows an intent that has been created with an action and some data.The action, in this case, is to view something. The data is a uniform resource identifier (URI), which identifies the location of the resource to view.For this example, the browser’s activity then starts and comes into foreground, causing the original calling activity to pause in the background. When the user finishes with the browser and clicks the Back button, the original activity resumes. Applications may also create their own intent types and allow other applications to call them, which makes it possible to develop tightly integrated application suites.

Launch an activity for a result Sometimes you want to launch an activity, have it determine something such as a user’s choice, and then return that information to the calling activity. When an activity needs a result, it can be launched using the Activity.startActivityForResult() method. The result is returned in the Intent parameter of the calling activity’s onActivityResult() method. We talk more about how to pass data using an Intent parameter in a moment.

Intents Intents are asynchronous messages which allow android components to request functionality from other components of the android components. An activity send an intent to another system which starts an other activity Intents are the instances of Android.content.Instance

Explicity Intent Explictiy intents explicitly name the component which should be called by the android system,by using the java class as identifier. Intent i = new Intent(this, ActivityTwo.class); i.putExtra("Value1", "This value one for ActivityTwo "); i.putExtra("Value2", "This value two ActivityTwo"); If this intent is correctly send to the android system,it will start the associated class.

Implicti Intents Implicit Intents do not specify the Java class which should be called. They specify the action which should be performed and optionally an URI which should be used for this action.

Gridlayout Android 4.0 (Ice Cream Sandwich) introduced a new type of layouts: the Gridlayout. Gridlayout is like the tag in HTML. child widgets are arranged in Cells made of Rows and Columns. Grid layout is a ViewGroup that can be used in constructing dashboard activities like that one in the Google Plus application:

Final in java In Java, final keyword is applied in various context. The final keyword is a modifier means the final class can't be extended, a variable can't be modified, and also a method can't be override