Activity Android Club 2015. Agenda Hello Android application Application components Activity StartActivity.

Slides:



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

Programming with Android: Activities and Intents Luca Bedogni Marco Di Felice Dipartimento di Informatica – Scienza e Ingegneria Università di Bologna.
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.
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,
@2011 Mihail L. Sichitiu1 Android Introduction Communication between Activities.
CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle.
Better reference the original webpage :
Getting Started with Android APIs Ivan Wong. Motivation - “Datasheet” - Recently exposed to what’s available in Android - So let’s see what API’s are.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Broadcast Receiver Android Club Agenda Broadcast Receiver Widget.
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.
Copyright© Jeffrey Jongko, Ateneo de Manila University Of Activities, Intents and Applications.
Android Programming-Activity Lecture 4. Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the.
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml.
Cosc 5/4730 Android Communications Intents, callbacks, and setters.
Linking Activities using Intents How to navigate between Android Activities 1Linking Activities using Intents.
Mobile Programming Midterm Review
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.
Introducing Intents Intents Bind application components and navigate between them Transform device into collection of interconnected systems Creating a.
Activities Димитър Н. Димитров Astea Solutions AD.
Intents 1 CS440. Intents  Message passing mechanism  Most common uses:  starting an Activity (open an , contact, etc.)  starting an Activity.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
Activity ANDROID CLUB Сегодня  Основные компоненты Android  Activity  Layout для Activity  Создание Activity  Launcher Activity  Activity.
Fragment Android Club Agenda Fragment Static fragment Dynamic fragment ViewPager.
Lecture 2: Android Concepts
Technische Universität München Services, IPC and RPC Gökhan Yilmaz, Benedikt Brück.
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
Speech Service & client(Activity) 오지영.
Intents and Broadcast Receivers Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Putting together the AndroidManifest.xml file Creating multiple.
Android Application -Architecture.
Concurrency in Android
Lecture 2: Android Concepts
Java Examples Embedded System Software
several communicating screens
Programming with Android:
Linking Activities using Intents
Android Moving to a second Activity
Communication between Activities
CS499 – Mobile Application Development
Activities and Intents
Anatomy of an Android App and the App Lifecycle
Android Mobile Application Development
The Android Activity Lifecycle
Android Introduction Camera.
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Anatomy of an Android App and the App Lifecycle
Activity Lifecycle Fall 2012 CS2302: Programming Principles.
Many thanks to Jun Bum Lim for his help with this tutorial.
Activities and Intents
Activities and Intents
CIS 470 Mobile App Development
Activity Lifecycle.
CIS 493/EEC 492 Android Sensor Programming
CIS 470 Mobile App Development
Objects First with Java
Activities and Intents
SE4S701 Mobile Application Development
Lecture 2: Android Concepts
Objects First with Java
Activities and Fragments
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Activity Android Club 2015

Agenda Hello Android application Application components Activity StartActivity

Hello Android! Let’s create your first app! Toast

Discover project structure src res AndroidManifest.xml gradle

Practice: create project Create Android project Name: MyProject

Practice: src Create another activity rather than MainActivity Name: AnotherActivity

Practice: AndroidManifest Make AndroidActivity main. Application should open AnotherActivity on start

Practice: gradle compile 'io.realm:realm-android:0.81.1'

Application components Activity Service BroadcastReceiver ContentProvider

Activity Activity – UI where user can interact with application One purpose

TaskBackstack

Game Button Back Button Which activity it will be?

Lifecycle

Example: lifecycle Logging lifecycle methods

Practice: lifecycle Find out how many methods will be called in this scenario: 1) Open app 2) Click home button 3)Open app from “Opened apps” 4)Click back button 5)Delete app from “Open apps”

How to start activity? startActivity startActivityForResult

startActivity Put button Set on click listener Open another activity

Practice: startActivity Put button on first activity: “Open third activity” Set on click listener startActivity using intent

Example: Pass data using Intent Pass data to another activity

Example: startActivityForResult Intent i = new Intent(this, SecondActivity.class); startActivityForResult(i, 1); Intent returnIntent = new Intent(); returnIntent.putExtra("result",result); setResult(RESULT_OK,returnIntent); finish();

Example: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { if(resultCode == RESULT_OK){ String result=data.getStringExtra("result"); if (resultCode == RESULT_CANCELED) { //Write your code if there's no result } } }

Practice: startActivityForResult Create one activity Create one button on first activity Open second activity when button clicked Second activity has 2 buttons: OKEY, BAD On result: show OKEY or BAD

Practice: startActivityForResult + data Create one activity Open second activity from first activity Put EditText to second activity Put button to return edittext’s text

Homework: Task 1 Create activity one Create 3 buttons on activity one: Red, Green, Blue Red: open RedActivity (background: red) Green: open GreenActivity (bg: green) Blue: open BlueActivity (bg: blue)

Homework: Task 2 Create ActivityOne Put edittext Users enters message and clicks “SEND” button SecondActivity shows message in TextView

Homework: Task 3 Create activity one Put one button Button open second activity EditText on SecondActivity User enters name in SecondActivity Show toast in FirstActivity: HELLO [NAME]!

Homework: Task 4 Create one activity. It should show counters onCreate():1 onStart():1 onResume():1 onPause():0 onStop():0 onPause():0

Questions? No question?

Thank you! Thank you very much for your attention!