SlideShare una empresa de Scribd logo
1 de 11
Android Button 
BHAVIN JOSHI 
125010693017 
1
Index 
 About Button 
 XML File 
 Java File 
 Example 
2
XML File 
<Button 
android:id="@+id/button1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content” 
android:text=“radiobutton" /> 
<ImageButton 
android:id="@+id/img_button1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content” 
android:src=“@drawable/droid” 
/> 
3
About Button 
A Basic Button is often use to perform some sort of 
actions, such as submitting a selection. 
A basic Button control can contain a text or image label. 
Within the xml layout resources, button are specified 
using “<button>” element. 
The Primary attribute for basic button is the field. This is 
the label that appear on middle of button’s face. 
Example. We often use button control with text 
“ok”,”cancel” and “submit”. 
4
JAVA File 
5 
1. Create a class implements the interface 
button.setOnClickListener 
2. Implement onClickListener() method 
3. Perform the action on Button using the method void 
onClick(). 
within the onClick() method, you are free to carry out 
whatever action you need.
Example 
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 
<ImageButton 
android:id="@+id/image_button" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content“ 
android:src=“@drawable/submit/” /> 
<Button 
android:id="@+id/button1“ 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="@string/Cancel” /> 
</LinearLayout> 
6
Cont…. 
7
Java Code of Example 
package sl.mc; 
import android.os.Bundle; 
import android.app.Activity; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 
import android.widget.ImageButton; 
import android.widget.Toast; 
public class MainActivity extends Activity { 
ImageButton button; 
Button button2; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_main); 
8
Cont… 
button=(ImageButton) findViewById(R.id.imageButton1); 
button2=(Button) findViewById(R.id.button1); 
button.setOnClickListener(new OnClickListener() { 
@Override 
public void onClick(View arg0) { 
// TODO Auto-generated method stub 
Toast.makeText(getApplicationContext(), "image button is click", 
Toast.LENGTH_LONG).show(); 
} 
}); 
9
Cont… 
button2.setOnClickListener(new OnClickListener() { 
@Override 
public void onClick(View arg0) { 
// TODO Auto-generated method stub 
Toast.makeText(getApplicationContext(), "Cancel Button is click", Toast.LENGTH_LONG).show(); 
} 
}); 
} 
10
Thank You 
11

Más contenido relacionado

La actualidad más candente

Android Architecture
Android ArchitectureAndroid Architecture
Android Architecturedeepakshare
 
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & ComponentsVijay Rastogi
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application DevelopmentBenny Skogberg
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android pptTaha Malampatti
 
Android activity
Android activityAndroid activity
Android activityKrazy Koder
 
Android animation
Android animationAndroid animation
Android animationKrazy Koder
 
Android resource
Android resourceAndroid resource
Android resourceKrazy Koder
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestateOsahon Gino Ediagbonya
 
Introduction to Android development - Presentation
Introduction to Android development - PresentationIntroduction to Android development - Presentation
Introduction to Android development - PresentationAtul Panjwani
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 

La actualidad más candente (20)

Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & Components
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
android layouts
android layoutsandroid layouts
android layouts
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android ppt
 
Android activity
Android activityAndroid activity
Android activity
 
Android UI
Android UIAndroid UI
Android UI
 
Android animation
Android animationAndroid animation
Android animation
 
Android intent
Android intentAndroid intent
Android intent
 
Android resource
Android resourceAndroid resource
Android resource
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Introduction to Android development - Presentation
Introduction to Android development - PresentationIntroduction to Android development - Presentation
Introduction to Android development - Presentation
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Database in Android
Database in AndroidDatabase in Android
Database in Android
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 

Destacado

Advanced portfolio research and planning
Advanced portfolio   research and planningAdvanced portfolio   research and planning
Advanced portfolio research and planningshanarochelle
 
Arizona Economic Housing Outlook
Arizona Economic Housing OutlookArizona Economic Housing Outlook
Arizona Economic Housing Outlooksjreiassociation
 
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial Networks
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial NetworksSuperframe Scheduling with Beacon Enable Mode in Wireless Industrial Networks
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial NetworksOka Danil
 
Remote Monitoring of Lead-Acid Battery Based on WLAN
Remote Monitoring of Lead-Acid Battery Based on WLANRemote Monitoring of Lead-Acid Battery Based on WLAN
Remote Monitoring of Lead-Acid Battery Based on WLANOka Danil
 
Mobile sites + apps
Mobile sites + appsMobile sites + apps
Mobile sites + appsYLLG
 
20150223_Infoday H2020_Espacio_Fernando Camacho
20150223_Infoday H2020_Espacio_Fernando Camacho20150223_Infoday H2020_Espacio_Fernando Camacho
20150223_Infoday H2020_Espacio_Fernando CamachoElena Cortés Ventura
 
Be a Part of Our Success
Be a Part of Our SuccessBe a Part of Our Success
Be a Part of Our Successosamuels1
 
Powerpoint unit 1 finished
Powerpoint unit 1 finishedPowerpoint unit 1 finished
Powerpoint unit 1 finishedDayna Crawford
 
Network-based Wireless for Remote Monitoring Lead-Acid Battery
Network-based Wireless for Remote Monitoring Lead-Acid BatteryNetwork-based Wireless for Remote Monitoring Lead-Acid Battery
Network-based Wireless for Remote Monitoring Lead-Acid BatteryOka Danil
 
Cd cover conventions analysis
Cd cover conventions analysisCd cover conventions analysis
Cd cover conventions analysisharrietturmore
 
Diseño de sistemas digitales con contadores
Diseño de sistemas digitales con contadoresDiseño de sistemas digitales con contadores
Diseño de sistemas digitales con contadoresSantiago Salinas Lopez
 
Recerca clínica en salut mental per Elisabet Vilella - Sessió de Residents 2...
Recerca clínica en salut mental per Elisabet Vilella -  Sessió de Residents 2...Recerca clínica en salut mental per Elisabet Vilella -  Sessió de Residents 2...
Recerca clínica en salut mental per Elisabet Vilella - Sessió de Residents 2...Grup Pere Mata
 

Destacado (20)

Advanced portfolio research and planning
Advanced portfolio   research and planningAdvanced portfolio   research and planning
Advanced portfolio research and planning
 
Arizona Economic Housing Outlook
Arizona Economic Housing OutlookArizona Economic Housing Outlook
Arizona Economic Housing Outlook
 
Powerpoint unit 1
Powerpoint unit 1 Powerpoint unit 1
Powerpoint unit 1
 
Basında Bugün Göztepe
Basında Bugün GöztepeBasında Bugün Göztepe
Basında Bugün Göztepe
 
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial Networks
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial NetworksSuperframe Scheduling with Beacon Enable Mode in Wireless Industrial Networks
Superframe Scheduling with Beacon Enable Mode in Wireless Industrial Networks
 
Basında Bugün Göztepe
Basında Bugün GöztepeBasında Bugün Göztepe
Basında Bugün Göztepe
 
Remote Monitoring of Lead-Acid Battery Based on WLAN
Remote Monitoring of Lead-Acid Battery Based on WLANRemote Monitoring of Lead-Acid Battery Based on WLAN
Remote Monitoring of Lead-Acid Battery Based on WLAN
 
Bao gia may 2015 -- CONPEN COFFEE -- CTY TNHH TM XNK KIẾN NAM
Bao gia may 2015 -- CONPEN COFFEE  -- CTY TNHH TM XNK KIẾN NAMBao gia may 2015 -- CONPEN COFFEE  -- CTY TNHH TM XNK KIẾN NAM
Bao gia may 2015 -- CONPEN COFFEE -- CTY TNHH TM XNK KIẾN NAM
 
Mobile sites + apps
Mobile sites + appsMobile sites + apps
Mobile sites + apps
 
20150223_Infoday H2020_Espacio_Fernando Camacho
20150223_Infoday H2020_Espacio_Fernando Camacho20150223_Infoday H2020_Espacio_Fernando Camacho
20150223_Infoday H2020_Espacio_Fernando Camacho
 
Be a Part of Our Success
Be a Part of Our SuccessBe a Part of Our Success
Be a Part of Our Success
 
Powerpoint unit 1 finished
Powerpoint unit 1 finishedPowerpoint unit 1 finished
Powerpoint unit 1 finished
 
Network-based Wireless for Remote Monitoring Lead-Acid Battery
Network-based Wireless for Remote Monitoring Lead-Acid BatteryNetwork-based Wireless for Remote Monitoring Lead-Acid Battery
Network-based Wireless for Remote Monitoring Lead-Acid Battery
 
Evaluation #6
Evaluation #6Evaluation #6
Evaluation #6
 
Cd cover conventions analysis
Cd cover conventions analysisCd cover conventions analysis
Cd cover conventions analysis
 
Diseño de sistemas digitales con contadores
Diseño de sistemas digitales con contadoresDiseño de sistemas digitales con contadores
Diseño de sistemas digitales con contadores
 
06_CI4_SOLID SURFACE_Nora Lardiés
06_CI4_SOLID SURFACE_Nora Lardiés06_CI4_SOLID SURFACE_Nora Lardiés
06_CI4_SOLID SURFACE_Nora Lardiés
 
Basında Bugün Göztepe
Basında Bugün GöztepeBasında Bugün Göztepe
Basında Bugün Göztepe
 
Basında Bugün Göztepe
Basında Bugün GöztepeBasında Bugün Göztepe
Basında Bugün Göztepe
 
Recerca clínica en salut mental per Elisabet Vilella - Sessió de Residents 2...
Recerca clínica en salut mental per Elisabet Vilella -  Sessió de Residents 2...Recerca clínica en salut mental per Elisabet Vilella -  Sessió de Residents 2...
Recerca clínica en salut mental per Elisabet Vilella - Sessió de Residents 2...
 

Similar a Android Button

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
 
4.preference management
4.preference management 4.preference management
4.preference management maamir farooq
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgetsPrajyot Mainkar
 
Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Joemarie Amparo
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectJoemarie Amparo
 
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
 
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusLearn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusEng Teong Cheah
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activitiesmaamir farooq
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in androidMahmudul Hasan
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI ReferenceGauntFace
 
android level 3
android level 3android level 3
android level 3DevMix
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updatedGhanaGTUG
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 

Similar a Android Button (20)

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
 
4.preference management
4.preference management 4.preference management
4.preference management
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgets
 
Android
AndroidAndroid
Android
 
Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
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
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusLearn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
 
Android Application Fundamentals.
Android Application Fundamentals.Android Application Fundamentals.
Android Application Fundamentals.
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
Layout
LayoutLayout
Layout
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI Reference
 
android level 3
android level 3android level 3
android level 3
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Android Button

  • 1. Android Button BHAVIN JOSHI 125010693017 1
  • 2. Index  About Button  XML File  Java File  Example 2
  • 3. XML File <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content” android:text=“radiobutton" /> <ImageButton android:id="@+id/img_button1" android:layout_width="wrap_content" android:layout_height="wrap_content” android:src=“@drawable/droid” /> 3
  • 4. About Button A Basic Button is often use to perform some sort of actions, such as submitting a selection. A basic Button control can contain a text or image label. Within the xml layout resources, button are specified using “<button>” element. The Primary attribute for basic button is the field. This is the label that appear on middle of button’s face. Example. We often use button control with text “ok”,”cancel” and “submit”. 4
  • 5. JAVA File 5 1. Create a class implements the interface button.setOnClickListener 2. Implement onClickListener() method 3. Perform the action on Button using the method void onClick(). within the onClick() method, you are free to carry out whatever action you need.
  • 6. Example <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ImageButton android:id="@+id/image_button" android:layout_width="wrap_content" android:layout_height="wrap_content“ android:src=“@drawable/submit/” /> <Button android:id="@+id/button1“ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Cancel” /> </LinearLayout> 6
  • 8. Java Code of Example package sl.mc; import android.os.Bundle; import android.app.Activity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.Toast; public class MainActivity extends Activity { ImageButton button; Button button2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); 8
  • 9. Cont… button=(ImageButton) findViewById(R.id.imageButton1); button2=(Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "image button is click", Toast.LENGTH_LONG).show(); } }); 9
  • 10. Cont… button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Cancel Button is click", Toast.LENGTH_LONG).show(); } }); } 10