SlideShare a Scribd company logo
1 of 51
Download to read offline
3
 Widget & UI
 Anuchit Chalothorn
 anoochit@gmail.com

Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Widget
Widget has properties, you can use activity
design to config the properties or use layout
editor to edit XML document.
Text View
XML Attribute
  ● android:textColor="#33333"
  ● android:text="Hello World"
  ● android:textSize="30sp"
Methods
  ● setText
  ● setTypeFace


Ref: http://developer.android.com/reference/android/widget/TextView.html
Edit Text
XML Attribute
  ● android:inputType="text"
Methods
  ● getText
  ● setText




Ref: http://developer.android.com/reference/android/widget/EditText.html
Edit Text inputType
●     text                                                 ●     number
●     textPersonName                                       ●     numberSigned
●     textPassword                                         ●     numberDecimal
●     numberPassword                                       ●     AutoCompleteTextView
●     textEmailAddress                                     ●     MultiAutoCompleteTextView
●     phone
●     textPostalAddress
●     textMultiLine
●     time
●     date



Ref: http://developer.android.com/guide/topics/ui/controls/text.html
Buttons
XML Attribute
      ● android:style="?android:attr/buttonStyleSmall"
      ● android:text="Button"
Methods
  ● setOnClickListener




Ref: http://developer.android.com/reference/android/widget/Button.html
Checkboxes
Methods
  ● isChecked
  ● setChecked(true)
  ● setOnClickListener




Ref: http://developer.android.com/reference/android/widget/CheckBox.html
Radio Buttons
Use with RadioGroup Layout
Methods
  ● isChecked
  ● toggle
  ● setOnClickListener




Ref: http://developer.android.com/guide/topics/ui/controls/radiobutton.html
Toggle Buttons
XML Attribute
  ● android:textOn="Vibrate on"
  ● android:textOff="Vibrate off"
Methods
  ● setOnCheckedChangeListener




Ref: http://developer.android.com/guide/topics/ui/controls/togglebutton.html
Workshop: Input Form
Create form input for register new user to the
system (fake), use following fields:
  ● Firstname Lastname (Edit Text)
  ● Birthdate (Edit Text, Datepicker)
  ● Gender (Radio Button)
  ● Subscribe (Checkbox)
  ● Email (Edit Text)
  ● Password (Edit Text)
  ● Submit Button (Button)
Spinner
The choices you provide for the spinner can
come from any source, but must be provided
through an SpinnerAdapter, such as an
ArrayAdapter if the choices are available in an
array or a CursorAdapter if the choices are
available from a database query.




Ref: http://developer.android.com/guide/topics/ui/controls/spinner.html
Spinner
String resource file:
Spinner spinner = (Spinner) findViewById(R.id.spinner);
// Create an ArrayAdapter using the string array and a default
spinner layout
ArrayAdapter<CharSequence> adapter = ArrayAdapter.
createFromResource(this,R.array.services, android.R.layout.
simple_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.
simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner.setAdapter(adapter);
Spinner
Methods
   ● getSelectedItem
   ● getSelectedItemId
   ● getSelectedItemPosition
Listener
   ● setOnClickListener
   ● setOnItemSelectedListener
List View
The display of elements in a lists is a very
common pattern in mobile applications. The
user sees a list of items and can scroll through
them.
List View
Listener
   ● setOnItemClickListener
   ● setOnLongClickListener
Multi Columns List View
Custom layout listview row, use adapter select
data show in custom layout
Alert Dialog
A dialog that can show a title, up to three
buttons, a list of selectable items, or a custom
layout.




Ref: http://developer.android.com/guide/topics/ui/dialogs.html
Dialog with Custom Layout
If you want to create your own dialogs, you
create a layout file for the dialog. This layout file
is assigned to the dialog via the
setContentView() method
Picker
Android provides controls for the user to pick a
time or pick a date as ready-to-use dialogs.
Using these pickers helps ensure that your
users can pick a time or date that is valid,
formatted correctly, and adjusted to the user's
locale.




Ref: http://developer.android.com/guide/topics/ui/controls/pickers.html
Time Picker
In Android, you can use android.widget.
TimePicker class to render a time picker
component to select hour and minute in a pre-
defined user interface, render a dialog box via
android.app.TimePickerDialog
Date Picker
In Android you can use android.widget.
DatePicker class to render a date picker
component to select day, month and year in a
pre-defined user interface and render dialog
box via android.app.DatePickerDialog.
ActionBar
The ActionBar is located at the top of the
activity. It can display the activity title, icon,
actions which can be triggered, additional views
Views other interactive items. It can also be
used for navigation in your application.




Ref: http://developer.android.com/guide/topics/ui/actionbar.html
ActionBar in old devices
ActionBar has introduced in Android 3.0, The
ActionBar Sherlock library allow to use the
ActionBar on old devices as Android 1.6
ActionBar : Home Button
The ActionBar shows an icon of your application, this is
called the home icon. If you select this icon the
onOptionsItemSelected() method will be called with the
value android.R.id.home. The recommendation is to
return to the main Activity in your program.

ActionBar actionbar = getActionBar();
actionbar.setHomeButtonEnabled(true);
Workshop: Navigating Up
Like home button, ActionBar can use as up
navigation or goto parent activity, to enable up
button use setDisplayHomeUpEnabled()
method. You should include
FLAG_ACTIVITY_CLEAR_TOP in the Intent.
ActionBar: Action View
a custom View can add to ActionBar, use
setCustomView method and enable display of
custom View via setDisplay methods in
ActionBar.DISPLAY_SHOW_CUSTOM flag.
Workshop: Action View
Create an App with ActionBar, has 2 option
menus refresh and setting, after push refresh
menu the show the progress bar.
ActionBar: Indeterminate progress
ActionBar can show progress bar use
requestWindowsFeature in request to use
interminate progress bar


requestWindowFeature(Window.
FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
ActionBar: Dimming navigation
You can also hide the software navigation button in
your Android application to have more space
available. If the user touches the button of the
screen the navigation button are automatically
shown again.
getWindow().
  getDecorView(). setSystemUiVisibility(View.
SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Notification
Android allows to put notification into the
titlebar of your application. The user can
expand the notification bar and by selecting the
notification the user can trigger another activity.




Ref: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
Notification
To create notifications you use the
NotificationManager class which can be
received from the Context, e.g. an activity or a
service, via the getSystemService() method.

Notification noti = new Notification.Builder(this)
        .setContentTitle("Title")
       .setContentText("Body").build();
Notification

NotificationManager notificationManager =
  (NotificationManager) getSystemService
(NOTIFICATION_SERVICE);

// Hide the notification after its selected
noti.flags |= Notification.FLAG_AUTO_CANCEL;

notificationManager.notify(0, noti);
Workshop: Notification
Create App with a single button, after push
button the notification will appear in the
notification bar and use can cancel notification.
End

More Related Content

Viewers also liked

Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location APIAnuchit Chalothorn
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design Rakesh Jha
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycleAhsanul Karim
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI ReferenceGauntFace
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsAhsanul Karim
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Day 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentDay 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentAhsanul Karim
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in BackgroundAhsanul Karim
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesAhsanul Karim
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
Acrhitecture deisign pattern_MVC_MVP_MVVM
Acrhitecture deisign pattern_MVC_MVP_MVVMAcrhitecture deisign pattern_MVC_MVP_MVVM
Acrhitecture deisign pattern_MVC_MVP_MVVMDong-Ho Lee
 

Viewers also liked (18)

Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location API
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design
 
Android UI Patterns
Android UI PatternsAndroid UI Patterns
Android UI Patterns
 
AndroidManifest
AndroidManifestAndroidManifest
AndroidManifest
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI Reference
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Android UI Development
Android UI DevelopmentAndroid UI Development
Android UI Development
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Day 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentDay 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver Component
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & Preferences
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Acrhitecture deisign pattern_MVC_MVP_MVVM
Acrhitecture deisign pattern_MVC_MVP_MVVMAcrhitecture deisign pattern_MVC_MVP_MVVM
Acrhitecture deisign pattern_MVC_MVP_MVVM
 
Advance Android Layout Walkthrough
Advance Android Layout WalkthroughAdvance Android Layout Walkthrough
Advance Android Layout Walkthrough
 
Android ppt
Android pptAndroid ppt
Android ppt
 

Similar to Android App Development 03 : Widget &amp; UI

Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to androidShrijan Tiwari
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatcbeyls
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android DivyaKS12
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updatedGhanaGTUG
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to BackCommonsWare
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...Ted Chien
 
Android App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsAndroid App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsDiego Grancini
 
Android training day 2
Android training day 2Android training day 2
Android training day 2Vivek Bhusal
 
Implementing cast in android
Implementing cast in androidImplementing cast in android
Implementing cast in androidAngelo Rüggeberg
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OSPankaj Maheshwari
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Desenvolver para Chromecast
Desenvolver para ChromecastDesenvolver para Chromecast
Desenvolver para ChromecastPedro Veloso
 

Similar to Android App Development 03 : Widget &amp; UI (20)

Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompat
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Android UI
Android UIAndroid UI
Android UI
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
Android
AndroidAndroid
Android
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to Back
 
Android session 3
Android session 3Android session 3
Android session 3
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
 
Android App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsAndroid App Development - 04 Views and layouts
Android App Development - 04 Views and layouts
 
Curso Básico Android
Curso Básico AndroidCurso Básico Android
Curso Básico Android
 
Android training day 2
Android training day 2Android training day 2
Android training day 2
 
Implementing cast in android
Implementing cast in androidImplementing cast in android
Implementing cast in android
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Desenvolver para Chromecast
Desenvolver para ChromecastDesenvolver para Chromecast
Desenvolver para Chromecast
 

More from Anuchit Chalothorn (20)

Flutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARUFlutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARU
 
Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020
 
13 web service integration
13 web service integration13 web service integration
13 web service integration
 
09 material design
09 material design09 material design
09 material design
 
07 intent
07 intent07 intent
07 intent
 
05 binding and action
05 binding and action05 binding and action
05 binding and action
 
04 layout design and basic widget
04 layout design and basic widget04 layout design and basic widget
04 layout design and basic widget
 
03 activity life cycle
03 activity life cycle03 activity life cycle
03 activity life cycle
 
02 create your first app
02 create your first app02 create your first app
02 create your first app
 
01 introduction
01 introduction 01 introduction
01 introduction
 
Material Theme
Material ThemeMaterial Theme
Material Theme
 
00 Android Wear Setup Emulator
00 Android Wear Setup Emulator00 Android Wear Setup Emulator
00 Android Wear Setup Emulator
 
MongoDB Replication Cluster
MongoDB Replication ClusterMongoDB Replication Cluster
MongoDB Replication Cluster
 
MongoDB Shard Cluster
MongoDB Shard ClusterMongoDB Shard Cluster
MongoDB Shard Cluster
 
IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
 
IT Automation with Puppet Enterprise
IT Automation with Puppet EnterpriseIT Automation with Puppet Enterprise
IT Automation with Puppet Enterprise
 
Using PhoneGap Command Line
Using PhoneGap Command LineUsing PhoneGap Command Line
Using PhoneGap Command Line
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
OpenStack Cheat Sheet V2
OpenStack Cheat Sheet V2OpenStack Cheat Sheet V2
OpenStack Cheat Sheet V2
 
REST API with CakePHP
REST API with CakePHPREST API with CakePHP
REST API with CakePHP
 

Android App Development 03 : Widget &amp; UI

  • 1. 3 Widget & UI Anuchit Chalothorn anoochit@gmail.com Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
  • 2. Widget Widget has properties, you can use activity design to config the properties or use layout editor to edit XML document.
  • 3.
  • 4.
  • 5. Text View XML Attribute ● android:textColor="#33333" ● android:text="Hello World" ● android:textSize="30sp" Methods ● setText ● setTypeFace Ref: http://developer.android.com/reference/android/widget/TextView.html
  • 6. Edit Text XML Attribute ● android:inputType="text" Methods ● getText ● setText Ref: http://developer.android.com/reference/android/widget/EditText.html
  • 7. Edit Text inputType ● text ● number ● textPersonName ● numberSigned ● textPassword ● numberDecimal ● numberPassword ● AutoCompleteTextView ● textEmailAddress ● MultiAutoCompleteTextView ● phone ● textPostalAddress ● textMultiLine ● time ● date Ref: http://developer.android.com/guide/topics/ui/controls/text.html
  • 8. Buttons XML Attribute ● android:style="?android:attr/buttonStyleSmall" ● android:text="Button" Methods ● setOnClickListener Ref: http://developer.android.com/reference/android/widget/Button.html
  • 9. Checkboxes Methods ● isChecked ● setChecked(true) ● setOnClickListener Ref: http://developer.android.com/reference/android/widget/CheckBox.html
  • 10. Radio Buttons Use with RadioGroup Layout Methods ● isChecked ● toggle ● setOnClickListener Ref: http://developer.android.com/guide/topics/ui/controls/radiobutton.html
  • 11. Toggle Buttons XML Attribute ● android:textOn="Vibrate on" ● android:textOff="Vibrate off" Methods ● setOnCheckedChangeListener Ref: http://developer.android.com/guide/topics/ui/controls/togglebutton.html
  • 12. Workshop: Input Form Create form input for register new user to the system (fake), use following fields: ● Firstname Lastname (Edit Text) ● Birthdate (Edit Text, Datepicker) ● Gender (Radio Button) ● Subscribe (Checkbox) ● Email (Edit Text) ● Password (Edit Text) ● Submit Button (Button)
  • 13.
  • 14. Spinner The choices you provide for the spinner can come from any source, but must be provided through an SpinnerAdapter, such as an ArrayAdapter if the choices are available in an array or a CursorAdapter if the choices are available from a database query. Ref: http://developer.android.com/guide/topics/ui/controls/spinner.html
  • 15. Spinner String resource file: Spinner spinner = (Spinner) findViewById(R.id.spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter. createFromResource(this,R.array.services, android.R.layout. simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout. simple_spinner_dropdown_item); // Apply the adapter to the spinner spinner.setAdapter(adapter);
  • 16. Spinner Methods ● getSelectedItem ● getSelectedItemId ● getSelectedItemPosition Listener ● setOnClickListener ● setOnItemSelectedListener
  • 17.
  • 18. List View The display of elements in a lists is a very common pattern in mobile applications. The user sees a list of items and can scroll through them.
  • 19. List View Listener ● setOnItemClickListener ● setOnLongClickListener
  • 20.
  • 21. Multi Columns List View Custom layout listview row, use adapter select data show in custom layout
  • 22.
  • 23.
  • 24. Alert Dialog A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout. Ref: http://developer.android.com/guide/topics/ui/dialogs.html
  • 25.
  • 26. Dialog with Custom Layout If you want to create your own dialogs, you create a layout file for the dialog. This layout file is assigned to the dialog via the setContentView() method
  • 27.
  • 28. Picker Android provides controls for the user to pick a time or pick a date as ready-to-use dialogs. Using these pickers helps ensure that your users can pick a time or date that is valid, formatted correctly, and adjusted to the user's locale. Ref: http://developer.android.com/guide/topics/ui/controls/pickers.html
  • 29. Time Picker In Android, you can use android.widget. TimePicker class to render a time picker component to select hour and minute in a pre- defined user interface, render a dialog box via android.app.TimePickerDialog
  • 30.
  • 31. Date Picker In Android you can use android.widget. DatePicker class to render a date picker component to select day, month and year in a pre-defined user interface and render dialog box via android.app.DatePickerDialog.
  • 32.
  • 33. ActionBar The ActionBar is located at the top of the activity. It can display the activity title, icon, actions which can be triggered, additional views Views other interactive items. It can also be used for navigation in your application. Ref: http://developer.android.com/guide/topics/ui/actionbar.html
  • 34. ActionBar in old devices ActionBar has introduced in Android 3.0, The ActionBar Sherlock library allow to use the ActionBar on old devices as Android 1.6
  • 35. ActionBar : Home Button The ActionBar shows an icon of your application, this is called the home icon. If you select this icon the onOptionsItemSelected() method will be called with the value android.R.id.home. The recommendation is to return to the main Activity in your program. ActionBar actionbar = getActionBar(); actionbar.setHomeButtonEnabled(true);
  • 36.
  • 37. Workshop: Navigating Up Like home button, ActionBar can use as up navigation or goto parent activity, to enable up button use setDisplayHomeUpEnabled() method. You should include FLAG_ACTIVITY_CLEAR_TOP in the Intent.
  • 38.
  • 39. ActionBar: Action View a custom View can add to ActionBar, use setCustomView method and enable display of custom View via setDisplay methods in ActionBar.DISPLAY_SHOW_CUSTOM flag.
  • 40. Workshop: Action View Create an App with ActionBar, has 2 option menus refresh and setting, after push refresh menu the show the progress bar.
  • 41.
  • 42. ActionBar: Indeterminate progress ActionBar can show progress bar use requestWindowsFeature in request to use interminate progress bar requestWindowFeature(Window. FEATURE_INDETERMINATE_PROGRESS); setProgressBarIndeterminateVisibility(true);
  • 43.
  • 44. ActionBar: Dimming navigation You can also hide the software navigation button in your Android application to have more space available. If the user touches the button of the screen the navigation button are automatically shown again. getWindow(). getDecorView(). setSystemUiVisibility(View. SYSTEM_UI_FLAG_HIDE_NAVIGATION);
  • 45.
  • 46. Notification Android allows to put notification into the titlebar of your application. The user can expand the notification bar and by selecting the notification the user can trigger another activity. Ref: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
  • 47. Notification To create notifications you use the NotificationManager class which can be received from the Context, e.g. an activity or a service, via the getSystemService() method. Notification noti = new Notification.Builder(this) .setContentTitle("Title") .setContentText("Body").build();
  • 48. Notification NotificationManager notificationManager = (NotificationManager) getSystemService (NOTIFICATION_SERVICE); // Hide the notification after its selected noti.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, noti);
  • 49. Workshop: Notification Create App with a single button, after push button the notification will appear in the notification bar and use can cancel notification.
  • 50.
  • 51. End