1 | 2010 Activity og GUI Android Brugergrænseflade.

Slides:



Advertisements
Similar presentations
Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Advertisements

Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Programming with Android: Data management
Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from.
ANDROID DEVELOPMENT KELLY MCBEAN. DEVELOPMENT ENVIRONMENT OVERVIEW Eclipse Standard IDE for Developing Android Applications Install: 1.Java (JDK) – Since.
GUI og XML programmering Hvor meget kode og hvor meget XML?
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
CE881: Mobile and Social Application Programming Simon M. Lucas Quiz, Walkthrough, Exercise, Lifecycles, Intents.
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Android Activity Class (Android Activities) Brugergrænseflade og brugeraktioner er en aktivitet // ** The Activity Class ******************************************
M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 2 Android Application Step by Step Eleonora Todorova Boyan Iliev.
Android User Interface
Cosc 5/4730 Android: “Dynamic” data.. Saving Dynamic data. While there are a lot of ways to save data – Via the filesystem, database, etc. You can also.
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
CSS216 MOBILE PROGRAMMING Android, Chapter 3 Book: “Professional Android™ 2 Application Development” by Reto Meier, 2010 by: Andrey Bogdanchikov (
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.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
@2011 Mihail L. Sichitiu1 Android Introduction Hello Views Part 1.
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Android: Layouts David Meredith
Android UI, and Networking. Can do most networking on Android Bluetooth only on 2.0, Not supported with version 1.6.
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
Better reference the original webpage :
Introducing the Sudoku Example
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.
Chapter 9: Customize! Navigating with Tabs on a Tablet App.
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 – INTERFACE AND LAYOUT L. Grewe. Interfaces: Two Alternatives Code or XML  You have two ways you can create the interface(s) of your Application.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
Mobile Programming Lecture 6
DUE Hello World on the Android Platform.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
User Interfaces: Part 1 (View Groups and Layouts).
Android – Fragments L. Grewe.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
Video Games list lab 6  At the end of this lab you will be expected to know:  What Views, View Groups, Layouts, and Widgets are and how they relate to.
ANDROID – A FIRST PROGRAM L. Grewe Using AndroidStudio –basic Android  Lets do a “Hello World Project”  Start up AndroidStudio (assume you have installed.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
ListView and ExpandableListView
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Mobile Programming Lecture 4 Resources, Selection, Activities, Intents.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Chapter 2: Simplify! The Android User Interface
Lab7 – Appendix.
GUI Programming Fundamentals
Android – Event Handling
Android Moving to a second Activity
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
Activities and Intents
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
ITEC535 – Mobile Programming
Chapter 3: Coding the GUI Programmatically, Layout Managers
Android Programming Lecture 6
Chapter 9: Fragments.
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Android Topics Custom ArrayAdapters Creating an Event Listener
Android Developer Fundamentals V2
Mobile Programmming Dr. Mohsin Ali Memon.
Presentation transcript:

1 | 2010 Activity og GUI Android Brugergrænseflade

2 | 2010 Android Application Class Svarer ”nogenlunde” til J2ME Midlet “Base class for those who need to maintain global application state. You can provide your own implementation by specifying its name in your AndroidManifest.xml's tag, which will cause that class to be instantiated for you when the process for your application/package is created.” Kan håndterer onCreate, onTerminate, onLowMemory og onConfigurationChanged events

Eksempel Application class 3 | 2010 // ** The Application Class *************************************** // // ******************************************************************* // ** Listing 3-7: Skeleton application class // Appliction Class Extenstion import android.app.Application; import android.content.res.Configuration; public class MyApplication extends Application { private static MyApplication singleton; // Returns the application instance public static MyApplication getInstance() { return singleton; public final void onCreate() { super.onCreate(); singleton = this; } // Manifest entry <application android:name="MyApplication"> [... Manifest nodes...]

4 | 2010 Android Activity Class (Android Activities) Brugergrænseflade og brugeraktioner er en aktivitet // ** The Activity Class ****************************************** // package com.paad.myapplication; import android.app.Activity; import android.os.Bundle; public class MyActivity extends Activity { /** Called when the activity is first created. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } // ** Activity layout in XML <activity android:name=".MyActivity">

5 | 2010 Activity bruger View og Layout til UI og interaktion med brugeren Activity og Form svarer til hinanden: Præsentere et skærmbillede 1:1 Activity bruger Views, Layout og Widgets/Controls (Standard eller egne) Der findes en sæt af specielt designede Activities i forhold til standard widgets MapActivty, List Activty, ExpandableListActivty og TabActivity Tilstand styret af Android Framework. Mange Activities i en applikation kan give behov for eget Application objekt. “This hierarchy tree can be as simple or complex as you need it to be, and you can build it up using Android's set of predefined widgets and layouts, or with custom Views that you create yourself”. Screen Layout

6 | 2010 Klassehieraki

7 | 2010 Activity ->Layout-> View -> Widget &| ->UI Control View er adgangen til skærmressourcen på enheden Layout er manageren, der kontrollere View opsætningen Widget er en kontrol i View, og som ligner den rigtige verdens ting. Et ur eller et kompas. Kan også være et View UI control er grafiske enheder som knapper eller ”gestures” // ** Listing 4-1: Inflating an Activity public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); TextView myTextView = (TextView)findViewById(R.id.myTextView); } // ** Listing 4-2: Creating a UI layout in public void onCreate(Bundle icicle) { super.onCreate(icicle); TextView myTextView = new TextView(this); setContentView(myTextView); myTextView.setText("Hello, Android"); }

8 | 2010 Klassediagram Et eksempel Fra

9 | 2010 Layout hvordan XML og kode <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter Text Below" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Text Goes Here!" /> LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); TextView myTextView = new TextView(this); EditText myEditText = new EditText(this); myTextView.setText("Enter Text Below"); myEditText.setText("Text Goes Here!"); int lHeight = LinearLayout.LayoutParams.FILL_PARENT; int lWidth = LinearLayout.LayoutParams.WRAP_CONTENT; ll.addView(myTextView, new LinearLayout.LayoutParams(lHeight, lWidth)); ll.addView(myEditText, new LinearLayout.LayoutParams(lHeight, lWidth)); setContentView(ll);

10 | 2010 Hvad er der så at holde styr på i GUI’en? View ViewGroup Layout Widget Package Menu (Menu knappen) View properties: Statisk og/eller dynamisk. UI Events Define an event listener and register it with the View Override an existing callback method for the View (Custom Views) Menu Events

11 | 2010 Event Listners application/ application/ 1.Inline Clas Implementation 2.Bruge “Implements” metoden 3.Bruge en variabel til en listner metode 4.XML attribute android:onClick="click1” Sørg for at have en void click1(View v){ …} i Activity

12 | 2010 Event Listners application/ application/ 1.Inline Clas Implementation 2.Bruge “Implements” metoden 3.Bruge en variabel til en listner metode 4.XML attribute android:onClick="click1” Sørg for at have en void click1(View v){ …} i Activity

13 | 2010