0% found this document useful (0 votes)
38 views8 pages

Recommended Link: Android Gui Component

This document outlines the key components of designing user interfaces for Android applications, including an overview of activity lifecycles, common layouts like linear, relative and table layouts, widgets for buttons, text fields and lists, and how to define and handle user interface events using listeners and callback methods. Code examples are provided to demonstrate notifications, dialogs, and handling user input from widgets.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views8 pages

Recommended Link: Android Gui Component

This document outlines the key components of designing user interfaces for Android applications, including an overview of activity lifecycles, common layouts like linear, relative and table layouts, widgets for buttons, text fields and lists, and how to define and handle user interface events using listeners and callback methods. Code examples are provided to demonstrate notifications, dialogs, and handling user input from widgets.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

RECOMMENDED LINK

Activities Life Cycle


http://mobileorchard.com/android-appdevelopment-activity-life-cycle/

CH11
ANDROID GUI COMPONENT
Mobile Application Development

Designing USER INTERFACE


http://developer.android.com/guide/topics/ui/in dex.html

Chapter Outline
1. Android App Development: Activity Life Cycle 2. Design User Interface - View - Layout - Widget - UI Event 3. Code Example 4. Summary & Discussion

Review: Android Project

Android version

Directory name

Name that appears on device

Java package

Class to automatically create

(2 Review: Explore Project (2)

Review: Output of HelloAndroid (3)

1. Android App Development: Activity Life Cycle

(2 1. Activity Lifecycle (2)

2. Design User Interface


View Hierarchy Layout
Ex. LinearLayout, FrameLayout, RelativeLayout

2.1 View Hierarchy

Widgets
Ex Button, TextView, EditText, ListView, CheckBox, RadioButton, Gallery,

UI Event Menus

2.2 LAYOUT
2.2.1 FrameLayout 2.2.2 LinearLayout 2.2.3 TableLayout 2.2.4 RelativeLayout

2.2.1 LINEAR LAYOUT

2.2.2 TABLE LAYOUT

2.2.3 RELATIVE LAYOUT

2.3 Views and Widgets


Provide common UI functionality Form elements: ex. text area, button, radio button, checkbox, dropdown list, etc. Date and time pickers Auto-complete Can mostly be placed in UI using main.xml

2.3 View & Widget (2)


TextView EditText: title

TextView

EditText: description Spinner: spinner Button: save Button: clear

2.3 View & Widget (3)

Ex. Notifications (2)

SEE CODE 1 GUI COMPONENT

(2 Ex. Notification (2)

Ex. Dialogs

SEE CODE 3 NOTIFICATION


Button: clear

Ex. Dialog lifecycle


NONE

Ex. ShowDialog (3)

showDialog onCreateDialog

removeDialog

CREATED onPrepareDialog showDialog

Ex. Widget (3)

2.4 Defining Event


Developer can define event for 2 waysA Define an event listener & register it with the View Override an existing callback method for the View

SEE CODE 4 DIALOG

(2 2.4 Handling UI Event (2)


2.4.1 Event Listeners Ex. onClick(), onLongClick(), onFocusChange(), onTouch(), onCreateContextMenu() 2.4.2 Event Handlers Ex. onKeyDown(int, KeyEvent), onKeyUp(int, KeyEvent), onTouchEvent(MotionEvent)

(2 2.4.1 Handling UI Event (2)

2.4.2 Onkeydown Example

Handling user interaction


EditText: title EditText: description

Button: clear

View & Widget (3)

Discussion & Question?

SEE CODE 2.1-2.2 Handling UI

You might also like