Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Advertisements

Android User Interface
Creating and Editing a Web Page Using Inline Styles
1. Chapter 29 Creating Forms 3 Understanding Forms Word enables you to create fill-in forms to eliminate the need for storing pre-printed forms. Add.
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,
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Introducing the Sudoku Example
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Modify Android Objects Using.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
PROG Mobile Java Application Development PROG Mobile Java Application Development Developing Android Apps: Components & Layout.
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.
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.
Basic Android Tutorial USF’s Association for Computing Machinery.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
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 One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Android Boot Camp for Developers Using Java, 3E
Application Development for mobile Devices
Android – Fragments L. Grewe.
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.
© 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 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
First Venture into the Android World Chapter 1 Part 2.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Creating and Editing a Web Page
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.
Building User Interfaces Basic Applications
© 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.
Chapter 2 Building User Interfaces and Basic Applications.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
School of Engineering and Information and Communication Technology KIT305/KIT607 Mobile Application Development Android OS –Permissions (cont.), Fragments,
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 5 Using a Template to Create a Resume and Sharing a Finished Document Microsoft Word 2013.
Chapter 2: Simplify! The Android User Interface
Open Handset Alliance.
Chapter 1: An Introduction to Visual Basic 2015
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
Activities, Fragments, and Events
Chapter 2 – Introduction to the Visual Studio .NET IDE
MAD.
Mobile Application Development Chapter 5 [Persistent Data in Android]
Activities and Intents
Program and Graphical User Interface Design
Creation of an Android App By Keith Lynn
Sensors, maps and fragments:
Android – Fragments L. Grewe.
ANDROID UI – FRAGMENTS UNIT II.
Chap 7. Building Java Graphical User Interfaces
Android SDK & App Development
An Introduction to Using
Program and Graphical User Interface Design
MODULE 7 Microsoft Access 2010
Building User Interfaces Basic Applications
Microsoft Office Access 2003
Programming Mobile Applications with Android
CIS 470 Mobile App Development
Guidelines for Microsoft® Office 2013
Mobile Programmming Dr. Mohsin Ali Memon.
Presentation transcript:

Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017

Contents Activities, Layouts and Intents Creating the Interface of the ContactList App Activating the Interface

Activities, Layouts & Intents Activities, Layouts and Intents are the three objects used as a basis for the structure of an Android app. Activities & Layouts work together to present a display that the user can interact with. Intents are objects that are used to switch between activities in an app.

Activities, Layouts & Intents The Activity Class The Activity class is designed to handle a single task that the user can perform. The Activity class is not directly instantiated in an Android app. Rather, it is sub-classed (inherited) for every activity that the developer needs to create in the app. This way developers can inherit all the functionality of the Activity class in addition to adding their own unique functionality through Java code. One of the most important inherited functions of the Activity class is the capability to respond to life cycle events such as onCreate and onPause. The Activity subclasses developed by the user are stored as .java files in the app project’s java folder.

Activities, Layouts & Intents The Activity Class The Activity class has several subclasses, among which are: FragmentActivity subclass : Fragments allow the developer to include multiple tasks or panes within a single activity. This class is also used to make an app backward compatible to OS versions earlier than 11. ListActivity subclass: designed to specifically support the development of a list interface.

Activities, Layouts & Intents The Layout A layout is the visual component of a user interface in Android. The layout is not a class but rather an XML file that is used to tell the operating system what visual objects are to bedisplayed, how those objects are configured, and where those objects should be displayed on the screen. The objects that make up an Android interface are referred to as widgets . Widgets are subclasses of the View class. Android widgets include widgets to define where other widgets are displayed (for example, RelativeLayout ), to directly interact with the user (for example, RadioButton ), and to provide some type of navigation within the interfaces (for example, ScrollView ). Layouts can also be defined at runtime by instantiating the widgets that make up an interface and configuring them as needed. However, designing the interface is more difficult because you cannot see the layout until you run the app.

Activities, Layouts & Intents The Intent class An Intent is a class that is used to describe an operation to be performed. An Intent is essentially a message that defines an action to be taken and the data that the action is to be performed on. Intents are the primary way in which the developer starts new activities within the app. Intents can also be used to communicate between activities. Intents can be used to start activities or broadcast both within and outside the app to provide instructions and data to other activities.

Creating the Interface of the ContactList App The MyContactList app requires four screens, i.e. ; four activities and four layouts to provide the desired functionality Contact Screen Contact List Screen Map Screen Settings Screen The app will use Intents to switch between activities and pass data between these activities. The app will also use four images, one for the app icon and three for the navigation bar. The images have to be copied (imported) into the drawable folder.

Creating the Interface Create the Navigation Bar The navigation bar for the MyContactList app sits at the bottom of all screens and allows the user to quickly move between different functions in the app by tapping one of the images on the bar. The navigation bar is made up of three ImageButtons contained within a RelativeLayout . The RelativeLayout is set to be as big as the three buttons and is placed within the root RelativeLayout, which was placed in the layout files of the created activities. The navigation layout is anchored to the bottom of the root layout so that it always appears at the bottom of the screen.

Creating the Interface Create the Navigation Bar

Creating the Interface Create the Navigation Bar Once the navigation bar is coded, it can be copied into each of the other three activities’ layouts. The copied xml code must include the start <RelativeLayout and end </RelativeLayout> tags.

Creating the Interface Create the Contact Layout There are three major sections in this layout. The navigation bar (completed in the previous section) The toolbar, which is another RelativeLayout displayed at the top of the screen that allows the user to access overall functionality of the Contact screen. The ScrollView (Data Entry form) that holds all the widgets that allow the user to enter information about a contact. A ScrollView is used to ensure that users can access all the data entry widgets regardless of the size of the used device.

Creating the Interface Create the Contact Layout >> Toolbar The toolbar consists of : A RelativeLayout positioned at the top of the root layout A ToggleButton to switch between editing and viewing modes A Button to allow the user to save changes to the contact’s information.

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) The ScrollView or the data form portion of the Contact Layout allows users to enter information on their contacts. It primarily relies on the EditText and TextView widgets. The ScrollView is placed between the navigation bar and the toolbar. By default the ScrollView has a LinearLayout as its only contents. ScrollViews can have only one widget as their contents. However, if that widget is some type of layout, more widgets can be added as long as they are within that layout. LinearLayouts allow a simple display of widgets one right after the other either vertically or horizontally. To get a more complex display, the LinearLayout is replaced with a RelativeLayout in the xml code.

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) Next step is to write the xml code for all widgets in the RelativeLayout of the ScrollView. You cannot place the widgets in the ScrollView, as it has already one widget, namely the RelativeLayout.

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) Drag a TextView to the RelativeLayout in the ScrollView .Then switch to XML view and modify the TextView attributes so that its ID is textContact , is aligned to the top and left of its parent, and it has a left margin of 10dp , a top margin of 5dp , and displays Contact: as its text. Then add an EditText for the user to enter the contact name. Code shown below.

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) Then add the Address TextView and EditText as shown below

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) The next step is to add the three TextViews and EditTexts required to enter the city, state and zip code of the contact. The xml attributes of these widgets are as follows:

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) Then the email and birthdate TextView and EditText. The xml attributes of these widgets are as follows:

Creating the Interface Create the Contact Layout >> ScrollView (Data Entry Form) This Button opens a DatePicker Dialog, where date is selected and displayed in the DateText

Creating the Interface Create the Contact Layout >> DatePicker Dialog Android provides a DatePickerDialog class that provides the functionality needed. However in this app, we will create a ‘date selection’ pop-up from scratch by creating a new empty layout file in the app layout folder. The birthday selection date pop-up consists of the following: DatePicker widget, which allows the user to select a specific date. Cancel and OK buttons. A LinearLayout for the DatePicker widget. A TableLayout for the two buttons. The DatePicker widget displays only at runtime

Activating the Interface Activating the Navigation Bar Similar code is applied for the other two buttons in the navigation bar, but with minor modifications. For the imageButtonMap the method initSettingsButton is declared, in which you change initListButton() to initMapButton() R.id.imageButtonList to R.id.imageButtonMap ContactListActivity.class to ContactMapActivity.class For the imageButtonSettings, the method initSettingsButton is declared, in which you change initListButton() to initSettingsButton() R.id.imageButtonList to R.id.imageButtonSettings ContactListActivity.class to ContactSettingsActivity.class Finally, the three methods must be called in the onCreate method to be ready for use once the user clicks the buttons

Activating the Interface Activating the Toggle Button in the Toolbar The Toggle button once pressed (On state), all widgets are enabled and can be edited. If the Toggle button is not pressed (Off state), all widgets are disabled. The ToggleButton's functionality requires the creation of two methods. A method to initialize the button to respond to the user. A method to enable/disable all the data entry widgets

Activating the Interface Activating the Toggle Button in the Toolbar After coding the methods, call them in the onCreate() method

Activating the Interface Activating the DatePicker Dialog The first task is to create a new java class (DatePickerDialog.java) to hold the following custom dialog code To develop a custom dialog, it needs a listener interface and associated method, a constructor, an onCreateView method, and a call to the listener method. Finally, the dialog must be dismissed at the end of every code path in the DialogFragment .

Activating the Interface Activating the DatePicker Dialog Before the dialog can be tested, it must be implemented in the activity that uses it. In this case it is the ContactActivity. The following steps must be carefully implemented. IT448- Fall2017

Activating the Interface Activating the DatePicker Dialog The last step is to code the Change button to make it display the dialog.

Extra Resources Running your app on a mobile device https://developer.android.com/training/basics/firstapp/running-app.html Android UI Layouts : https://www.tutorialspoint.com/android/android_user_interface_layouts.htm Android UI Controls : https://www.tutorialspoint.com/android/android_user_interface_controls.htm Android Event Handling https://www.tutorialspoint.com/android/android_event_handling.htm

Thank You ! IT448-Autumn2017