SlideShare una empresa de Scribd logo
1 de 28
Android Application Development User Interface Ahsanul Karim [email_address] Sentinel Solutions Ltd. http://www.sentinelbd.com
User Interface Today ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],We have already used  TextView ,  EditText  and  Button
User Interface Android Widget Toolbox Form Elements Tutorial ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.) ,[object Object],[object Object],3. onCreate()  
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Custom Button Normal Focused Pressed We’ll create an image button with 3 states Using the  Button  widget and an XML file that defines  three different images  to use for the  different button states. When the button is pressed, a short message will be displayed. ,[object Object],[object Object],[object Object],[object Object],This defines a single drawable resource, which will change its image based on the current state  of the button.
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Custom Button 3. Open the  res/layout/main.xml  file and add the  Button  element: The   android:background  attribute specifies the drawable  resource to use for the button background (which, when saved at res/drawable/android.xml,  is referenced as @drawable/android). This replaces the normal background image used for  buttons throughout the system. In order for the drawable to change its image based on the  button state, the image must be applied to the background
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Custom Button 4. o make the button do something when pressed, add the following code at the end of the  onCreate()  method: Normal Pressed After Pressed
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text In this section, you will create a text field for user input, using the  EditText  widget. Once text  has been entered into the field, the "Enter" key will display the text in a toast message. 1. Open the  res/layout/main.xml  file and add the  EditText  element (inside the  LinearLayout ): 2.
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text 2. To do something with the text that the user types, add the following code to the end of the  onCreate()  method:
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box In this section, you will create a checkbox for selecting items, using the  CheckBox  widget.  When the checkbox is pressed, a toast message will indicate the current state of the checkbox. 1. Open the  res/layout/main.xml  file and add the  CheckBox  element (inside the  LinearLayout ):
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box 2. To do something when the state is changed, add the following code to the end of the  onCreate()  method:
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Radio Button In this section, you will create two mutually-exclusive radio buttons (enabling one disables the  other), using the  RadioGroup  and  RadioButton  widgets.  When either radio button is pressed, a toast message will be displayed. ,[object Object],[object Object],It's important that the  RadioButton s are grouped together by the  RadioGroup  element so that  no more than one can be selected at a time. This logic is automatically handled by the Android  system. When one  RadioButton  within a group is selected, all others are automatically deselected
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Radio Button 2. To do something when each  RadioButton  is selected, you need an  View.OnClickListener . In this case, you want the listener to be re-usable, so add the following code to create a new  member in the  HelloFormStuff  Activity 3. Now, at the bottom of the  onCreate()  method, add the following:
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Radio Button
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Toggle Button In this section, you'll create a button used specifically for toggling between two states, using  the  ToggleButton  widget. This widget is an excellent alternative to radio buttons if you have two simple states that are mutually exclusive ("on" and "off", for example). ,[object Object],[object Object]
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Toggle Button 2. To do something when the state is changed, add the following code to the end of the  onCreate()  method: This captures the  ToggleButton  element from the layout, then adds an  View.OnClickListener .  The  View.OnClickListener  must implement the  onClick(View)  callback method, which defines the action to perform when the button is clicked. In this example, the callback method checks  the new state of the button, then shows a  Toast  message that indicates the current state.
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Toggle Button
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Rating Bar In this section, you'll create a widget that allows the user to provide a rating, with the  RatingBar  widget. ,[object Object],[object Object],2. To do something when a new rating has been set, add the following code to the end of  the  onCreate()  method:
User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Rating Bar
User Interface Android Widget Toolbox Auto Complete Tutorial To create a text entry widget that provides auto-complete suggestions, use the  AutoCompleteTextView  widget. Suggestions are received from a collection of strings associated  with the widget through an  ArrayAdapter In this tutorial, you will create a  AutoCompleteTextView  widget that provides suggestions for  a country name.
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 1. Start a new project named  HelloAutoComplete . 2. Create an XML file named list_item.xml and save it inside the  res/layout/  folder.  Edit the file to look like this: This file defines a simple  TextView  that will be used for each item that appears in the list  of suggestions
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 3. Open the  res/layout/main.xml  file and insert the following: The  TextView  is a label that introduces the  AutoCompleteTextView  widget.
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 4. Open  HelloAutoComplete.java  and insert the following code for the  onCreate()  method: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 5. Inside the  HelloAutoComplete  class, add the string array:
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 6. Run the application
User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 7. Recommended: This can be done with a <string-array< resource in your project  res/values/strings.xml  file. For example: 8. From source code:

Más contenido relacionado

La actualidad más candente

Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training Moutasm Tamimi
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menusmyrajendra
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management systemPooja Dixit
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Presentation on array
Presentation on array Presentation on array
Presentation on array topu93
 
Working with visual basic applications
Working with visual basic applicationsWorking with visual basic applications
Working with visual basic applicationsSara Corpuz
 
Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in javaTech_MX
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
ServletConfig & ServletContext
ServletConfig & ServletContextServletConfig & ServletContext
ServletConfig & ServletContextASHUTOSH TRIVEDI
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual BasicSangeetha Sg
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaRahulAnanda1
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Androidma-polimi
 

La actualidad más candente (20)

Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
 
Er model
Er modelEr model
Er model
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menus
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Visual basic databases
Visual basic databasesVisual basic databases
Visual basic databases
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
 
Working with visual basic applications
Working with visual basic applicationsWorking with visual basic applications
Working with visual basic applications
 
Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in java
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
rdbms-notes
rdbms-notesrdbms-notes
rdbms-notes
 
C++ chapter 1
C++ chapter 1C++ chapter 1
C++ chapter 1
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
ServletConfig & ServletContext
ServletConfig & ServletContextServletConfig & ServletContext
ServletConfig & ServletContext
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual Basic
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Android
 

Destacado

Lecture 2(b) Android Internals A Quick Overview
Lecture 2(b) Android Internals A Quick OverviewLecture 2(b) Android Internals A Quick Overview
Lecture 2(b) Android Internals A Quick OverviewAhsanul 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 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: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerAhsanul Karim
 
Introduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedIntroduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedAhsanul Karim
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedAhsanul Karim
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in BackgroundAhsanul Karim
 
Day 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentDay 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentAhsanul Karim
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIAhsanul Karim
 
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
 
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
 
Day 2 android internals a quick overview
Day 2 android internals a quick overviewDay 2 android internals a quick overview
Day 2 android internals a quick overviewAhsanul Karim
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI WidgetsAhsanul Karim
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivityAhsanul Karim
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Ahsanul Karim
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)Ahsanul Karim
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 

Destacado (20)

Android Services
Android ServicesAndroid Services
Android Services
 
Lecture 2(b) Android Internals A Quick Overview
Lecture 2(b) Android Internals A Quick OverviewLecture 2(b) Android Internals A Quick Overview
Lecture 2(b) Android Internals A Quick Overview
 
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 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: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation Primer
 
Introduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedIntroduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting Started
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting Started
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Day 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver ComponentDay 6: Android BroadcastReceiver Component
Day 6: Android BroadcastReceiver Component
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location API
 
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
 
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
 
Day 2 android internals a quick overview
Day 2 android internals a quick overviewDay 2 android internals a quick overview
Day 2 android internals a quick overview
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)
 
Training android
Training androidTraining android
Training android
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 

Similar a Android User Interface: Basic Form Widgets

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
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidDenis Minja
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
intro_gui
intro_guiintro_gui
intro_guifilipb2
 
Programming Without Coding Technology (PWCT) - Functions and Procedures
Programming Without Coding Technology (PWCT) - Functions and ProceduresProgramming Without Coding Technology (PWCT) - Functions and Procedures
Programming Without Coding Technology (PWCT) - Functions and ProceduresMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Crystal Reports 10
Programming Without Coding Technology (PWCT) - Crystal Reports 10Programming Without Coding Technology (PWCT) - Crystal Reports 10
Programming Without Coding Technology (PWCT) - Crystal Reports 10Mahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationProgramming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationMahmoud Samir Fayed
 
Gui builder
Gui builderGui builder
Gui builderlearnt
 
Programming Without Coding Technology (PWCT) - Variables
Programming Without Coding Technology (PWCT) - VariablesProgramming Without Coding Technology (PWCT) - Variables
Programming Without Coding Technology (PWCT) - VariablesMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlProgramming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlMahmoud Samir Fayed
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxEqraKhattak
 
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)Mahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Convert the data type of varai...
Programming Without Coding Technology (PWCT) - Convert the data type of varai...Programming Without Coding Technology (PWCT) - Convert the data type of varai...
Programming Without Coding Technology (PWCT) - Convert the data type of varai...Mahmoud Samir Fayed
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Designfrancopw
 
Programming Without Coding Technology (PWCT) - Get Input From User
Programming Without Coding Technology (PWCT) - Get Input From UserProgramming Without Coding Technology (PWCT) - Get Input From User
Programming Without Coding Technology (PWCT) - Get Input From UserMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Mahmoud Samir Fayed
 

Similar a Android User Interface: Basic Form Widgets (20)

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]
 
Android UI
Android UIAndroid UI
Android UI
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
4.C#
4.C#4.C#
4.C#
 
Create New Android Layout
Create New Android LayoutCreate New Android Layout
Create New Android Layout
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
intro_gui
intro_guiintro_gui
intro_gui
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Programming Without Coding Technology (PWCT) - Functions and Procedures
Programming Without Coding Technology (PWCT) - Functions and ProceduresProgramming Without Coding Technology (PWCT) - Functions and Procedures
Programming Without Coding Technology (PWCT) - Functions and Procedures
 
Programming Without Coding Technology (PWCT) - Crystal Reports 10
Programming Without Coding Technology (PWCT) - Crystal Reports 10Programming Without Coding Technology (PWCT) - Crystal Reports 10
Programming Without Coding Technology (PWCT) - Crystal Reports 10
 
Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationProgramming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI Application
 
Gui builder
Gui builderGui builder
Gui builder
 
Programming Without Coding Technology (PWCT) - Variables
Programming Without Coding Technology (PWCT) - VariablesProgramming Without Coding Technology (PWCT) - Variables
Programming Without Coding Technology (PWCT) - Variables
 
Programming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlProgramming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab control
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptx
 
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)
Programming Without Coding Technology (PWCT) - Create Database Files (*.DBF)
 
Programming Without Coding Technology (PWCT) - Convert the data type of varai...
Programming Without Coding Technology (PWCT) - Convert the data type of varai...Programming Without Coding Technology (PWCT) - Convert the data type of varai...
Programming Without Coding Technology (PWCT) - Convert the data type of varai...
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
Programming Without Coding Technology (PWCT) - Get Input From User
Programming Without Coding Technology (PWCT) - Get Input From UserProgramming Without Coding Technology (PWCT) - Get Input From User
Programming Without Coding Technology (PWCT) - Get Input From User
 
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
 

Más de Ahsanul Karim

Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities Ahsanul Karim
 
Lecture 1 Session 1 Before Getting Started
Lecture 1 Session 1 Before Getting StartedLecture 1 Session 1 Before Getting Started
Lecture 1 Session 1 Before Getting StartedAhsanul Karim
 
লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:Ahsanul Karim
 
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 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 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycleAhsanul Karim
 
Mobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete StudyMobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete StudyAhsanul Karim
 
Ui layout (incomplete)
Ui layout (incomplete)Ui layout (incomplete)
Ui layout (incomplete)Ahsanul Karim
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_startedAhsanul Karim
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorialAhsanul Karim
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Ahsanul Karim
 
Android before getting started
Android before getting startedAndroid before getting started
Android before getting startedAhsanul Karim
 

Más de Ahsanul Karim (16)

Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
 
Lecture 1 Session 1 Before Getting Started
Lecture 1 Session 1 Before Getting StartedLecture 1 Session 1 Before Getting Started
Lecture 1 Session 1 Before Getting Started
 
লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:
 
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
 
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
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
 
Mobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete StudyMobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete Study
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
 
List Views
List ViewsList Views
List Views
 
Ui layout (incomplete)
Ui layout (incomplete)Ui layout (incomplete)
Ui layout (incomplete)
 
AndroidManifest
AndroidManifestAndroidManifest
AndroidManifest
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_started
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorial
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2
 
Android 1.8 sensor
Android 1.8 sensorAndroid 1.8 sensor
Android 1.8 sensor
 
Android before getting started
Android before getting startedAndroid before getting started
Android before getting started
 

Último

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Último (20)

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Android User Interface: Basic Form Widgets

  • 1. Android Application Development User Interface Ahsanul Karim [email_address] Sentinel Solutions Ltd. http://www.sentinelbd.com
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Custom Button 3. Open the  res/layout/main.xml  file and add the  Button  element: The   android:background  attribute specifies the drawable resource to use for the button background (which, when saved at res/drawable/android.xml, is referenced as @drawable/android). This replaces the normal background image used for buttons throughout the system. In order for the drawable to change its image based on the button state, the image must be applied to the background
  • 7. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Custom Button 4. o make the button do something when pressed, add the following code at the end of the  onCreate()  method: Normal Pressed After Pressed
  • 8. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text In this section, you will create a text field for user input, using the  EditText  widget. Once text has been entered into the field, the &quot;Enter&quot; key will display the text in a toast message. 1. Open the  res/layout/main.xml  file and add the  EditText  element (inside the  LinearLayout ): 2.
  • 9. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text 2. To do something with the text that the user types, add the following code to the end of the  onCreate()  method:
  • 10. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Edit Text
  • 11. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box In this section, you will create a checkbox for selecting items, using the  CheckBox  widget. When the checkbox is pressed, a toast message will indicate the current state of the checkbox. 1. Open the  res/layout/main.xml  file and add the  CheckBox  element (inside the  LinearLayout ):
  • 12. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box 2. To do something when the state is changed, add the following code to the end of the  onCreate()  method:
  • 13. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Check Box
  • 14.
  • 15. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Radio Button 2. To do something when each  RadioButton  is selected, you need an  View.OnClickListener . In this case, you want the listener to be re-usable, so add the following code to create a new member in the  HelloFormStuff  Activity 3. Now, at the bottom of the  onCreate()  method, add the following:
  • 16. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Radio Button
  • 17.
  • 18. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Toggle Button 2. To do something when the state is changed, add the following code to the end of the  onCreate()  method: This captures the  ToggleButton  element from the layout, then adds an  View.OnClickListener . The  View.OnClickListener  must implement the  onClick(View)  callback method, which defines the action to perform when the button is clicked. In this example, the callback method checks the new state of the button, then shows a  Toast  message that indicates the current state.
  • 19. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Toggle Button
  • 20.
  • 21. User Interface Android Widget Toolbox Form Elements Tutorial (Contd.)- Rating Bar
  • 22. User Interface Android Widget Toolbox Auto Complete Tutorial To create a text entry widget that provides auto-complete suggestions, use the  AutoCompleteTextView  widget. Suggestions are received from a collection of strings associated with the widget through an  ArrayAdapter In this tutorial, you will create a  AutoCompleteTextView  widget that provides suggestions for a country name.
  • 23. User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 1. Start a new project named  HelloAutoComplete . 2. Create an XML file named list_item.xml and save it inside the  res/layout/  folder. Edit the file to look like this: This file defines a simple  TextView  that will be used for each item that appears in the list of suggestions
  • 24. User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 3. Open the  res/layout/main.xml  file and insert the following: The  TextView  is a label that introduces the  AutoCompleteTextView  widget.
  • 25.
  • 26. User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 5. Inside the  HelloAutoComplete  class, add the string array:
  • 27. User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 6. Run the application
  • 28. User Interface Android Widget Toolbox Auto Complete Tutorial (Contd.) 7. Recommended: This can be done with a <string-array< resource in your project  res/values/strings.xml  file. For example: 8. From source code: