Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.

Slides:



Advertisements
Similar presentations
Android User Interface
Advertisements

Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Chapter 14 Exception Handling and Event Handling.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Basic Functionality in Android. Functionality in Android Events in Java – mouse related mouse clicked button down or up mouse entered – many others key.
@2010 Mihail L. Sichitiu1 Android Introduction Hello Views Part 2.
10.1 AWT The AWT classes Users today expect a Graphical User Interface (GUI) Improves application usability Difficult to implement cross-platform.
Layout and Control in UI The user interface (UI) is the graphical interface user can see and interact with your app comprising UI controls like textbox,
App Development on Android. Contents  First Milestone  Second Milestone  Third Milestone  Last Milestone 
CS378 - Mobile Computing User Interface Basics MIKE!! LOOK HERE FOR intercepting the ListView items:
ANDROID UI - DEVELOP AND DESIGN Peter Liu School of ICT, Seneca College.
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Chapter 12 Applets and Advanced Graphics  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets.
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
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.
Chapter 5 Creating User Interfaces GOALS and OBJECTIVES Begin our application by creating our user interface. More than one way to create a user interface.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
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.
Chapter 12 Applets and Advanced GUI  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets F.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
User Interfaces: Part 1 (View Groups and Layouts).
Application Development for mobile Devices
Presented By: Muhammad Tariq Software Engineer Android Training course.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Field Trip #32 Digital Alarm Clock By Keith Lynn.
1 CSC 222: Object-Oriented Programming Spring 2012 netBeans & GUIBuilder  netBeans IDE create/edit/run a project  GUIBuilder JFrame, JButton, JTextField,
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
User Interface Android Club Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Dialog boxes in JavaScript Events in JavaScript – What are they – “Which events are there?” – “How do I register event handlers to an HTML element?” –
SEEM3460 Tutorial GUI in Java. Some Basic GUI Terms Component (Control in some languages) the basic GUI unit something visible something that user can.
Handling View Events. Open the *MainActivity.java* which is the Activity that hosts the layout in "activity_main.xml". The setContentView method inside.
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.
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.
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
Lecture 33: More Graphical User Interface (GUI) Announcements & Review Read Ch GU1 & GU2 Cohoon & Davidson Ch 14 Reges & Stepp Lab 10 set game due 4/26.
Building User Interfaces Basic Applications
User Interface Layout Interaction. EventsEvent Handlers/Listeners Interacting with a user.
Events. Slide 2©SoftMoore Consulting Events Events are generated when a user interacts with the view objects of an application. Examples –button clicked–
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Http :// developer. android. com / guide / topics / fundamentals. html.
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
Java FX: Scene Builder.
Android – Event Handling
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Miscellaneous Topics #6: Polygons GUI Components and Event Handlers
CS371m - Mobile Computing User Interface Basics.
EE 422C Java FX.
CS371m - Mobile Computing User Interface Basics.
CISC124 Last Quiz this week. Topics listed in last Tuesday’s lecture.
Building User Interfaces Basic Applications
Android Developer Fundamentals V2
CISC124 Quiz 3 marking underway. Assn 5 due Friday. Fall 2018
Exception Handling and Event Handling
Android Developer Fundamentals V2
Mobile Programmming Dr. Mohsin Ali Memon.
Presentation transcript:

Designing user interfaces using: Simple views 1

Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton – RadioGroup – Spinner Pickers – TimePicker – DatePicker Lists – ListView – ListActivity – ListFragment 2 Designing user interfaces using: Simple views

View definition Views a usually defined in an XML file – Declarative – Example: res/layout/main.xml – Always in the folder res/layout – Each activity typically has one (or more) layout XML files. Views can be defined in the Activity – Programmatically – This is not the usual way – Useful if you want a dynamic number of Views Example: Quiz game where each question has a different number of possible answers – More on this later … 3 Designing user interfaces using: Simple views

Writing the view definition XML file The layout XML file can be written in two ways – Pure XML – Graphical drag-and-drop GUI builder The two ways can mixed Designing user interfaces using: Simple views 4

View configuration Some configuration can be done in the layout XML file – Width, height, etc. Some configuration must be done in the Activity Java class – Programming event handlers OnSomethingClicked(View …) etc. – Loading data into advanced views like lists 5 Designing user interfaces using: Simple views

Event handlers: Android vs. Windows forms Android Every GUI component has ONE event handler of a certain type Strategy design pattern – GUI component calls the event handler to handle the event – Changing strategy at runtime C# and Java event handlers, etc. Every GUI component can have any number of event handlers of a certain type – Usually 0 or 1, though Syntax C# – Obj.event += eventHandler Observer design pattern – Event handlers listen for changes in the GUI component – Adding / removing listeners at runtime 6 Designing user interfaces using: Simple views

Registering events for a view Buttons etc. Can register event handlers –btn.setOnClickListener(btnListener); Often using anonymous inner classes btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { // do something } }); Examples: ClickEventHandling project Android user interfaces using layouts7

Listening for User Interface notifications When you press a key the view in focus will try to handle the event – Example: EditText handles left + right arrows, but not up + down arrows Unhandled events are passed to the Activity – public boolean onKey(…) – Returned boolean value True: The event handling has finished False: The event handling has not finished Example: ClickEventHandling Android user interfaces using layouts8