SlideShare a Scribd company logo
Android Development
BootCamp
Day 04
Getting Familiar with Event Handling and Layouts
in Android
A Little Introduction to Myself...
Zainab Khan
Final Year Student of B.E Software from MUET.
Former DSC Expert Team Member.
Interested in Android Development and likes to work on it.
Would love to help you guys out with whatever I know.
You can connect with me on my:
zainabyounus63@gmail.com
https://www.facebook.com/zainab.younus.18/
www.linkedin.com/in/zainab-younus-khan
What we will be doing
today?
Look into three layouts of Android UI Development.
Which ones?
● Table Layout.
● Grid Layout.
● Frame Layout.
While exploring them, you’ll be learning ‘click/event handling’ in Android.
Last but no the least, we will try to cooperate with each other with the best
of our behaviours yeah? Don’t hesitate to ask a question in chatbox for
now, but remember we are going to learn together so I may not be the
perfect guru. LET’S LEARN TOGETHER :)
Let’s Start!
Event Handling
Handling Click Events
When you press a view (usually button) on your app’s UI, an event gets triggered resulting into
some action (preferably the desired one).
But how to handle those clicks to get that desired action performed?
Well, in Android there are two ways to handle button clicks. Let’s check them out!
1. Using onClick() method.
2. Using onClickListener().
1) Using onClick() method
Two steps:
1. Define onClick property of button in XML.
2. Now, handle the view in your Java file.
Day 4  android bootcamp
2) Using onClickListener()
As the name suggests, click listeners automatically listens for click events, so you don’t need to
explicitly mention an attribute for them in XML.
In Java file, Initialize the view (button in this case) and define a click listener for it.
Layouts
What is a Layout?
➔ A layout is something that defines the structure of a user interface in your app, using
hierarchies of views and view groups.
➔ It tells how the UI components will be rendered on the screen for the user.
Why are Layouts Important?
➔ If you are not putting your views into a particular structure or hierarchy, they will be
floating on the screen as they want, which is obviously not required.
➔ Structuring is important prior to designing.
➔ Inefficient use of layouts can frustrate your users, increase confusions, and lead to high
performance costs with inefficient use of resources and components.
Some Important Layouts
Linear Layout.
Relative Layout.
Table Layout.
Absolute Layout.
Frame Layout.
ListView.
Grid Layout.
Linear Layout is a view group that aligns all children in a single direction, vertically or
horizontally.
Relative Layout is a view group that displays child views in relative positions.
Table Layout is a view that groups views into rows and columns.
Absolute Layout enables you to specify the exact location of its children.
The Frame Layout is a placeholder on screen that you can use to display a single view.
ListView is a view group that displays a list of scrollable items.
Grid Layout is a layout manager that arranges the views in a grid..
TABLE LAYOUT
➔ Android TableLayout is going to be arrange groups of
views into rows and columns.
➔ You will use the <TableRow> element to build a row
in the table.
➔ Each row has zero or more cells; each cell can hold
one View object.
Grid Layout
➔ In Android GridLayout, we can specify the number of columns
and rows that the grid will have.
➔ We can customize the GridLayout according to our
requirements, like setting the size, color or the margin for the
Layout.
➔ So, a GridLayout basically places its children in a rectangular
grid. This grid has a set of a number of thin lines that separate
the view area into cells.
➔ Each item in a grid cell can be pointed using its index number.
Frame Layout
➔ Frame Layout is designed to block out an area on the screen to
display a single item.
➔ Generally, FrameLayout should be used to hold a single child
view, because it can be difficult to organize child views in a
way that's scalable to different screen sizes without the
children overlapping each other.
➔ You can, however, add multiple children to a FrameLayout and
control their position within the FrameLayout by assigning
gravity to each child, using the android:layout_gravity
attribute.
Are We DONE?
YES?
High Five!
Ask Away Questions!
Some Tips!
★ Try different things if you haven’t. Explore maps, databases, services, broadcasts, AI in android, different layouts, etc.
★ Try to implement SDLC phases.
★ Test your app. You can use automated tools or do it manually (Assure SW Quality)
★ Document even your simplest apps at least with a paragraph long description, along with some screenshots or short screen
recordings.
★ Upload them on Github PLEASE!
★ Make your LinkedIn profile and try to do things that can be fitted into it.
★ Make your Resume.
★ Make connections.
★ Participate in Coding Expos and Project Exhibitions.
★ MUST do internships of at least 3-4 weeks, in interested areas.
★ Go Native!
★ DON’T WASTE YOUR MONEY ON USELESS EVENTS. Other than the ones which teach you something you don’t know, and can
have a place in your experience count.
★ Join Communities and related groups.
★ Stay Connected and HELP each other :)
References
https://developer.android.com/guide/topics/ui/controls/button#java
https://developer.android.com/guide/topics/ui/declaring-layout
https://www.tutorialspoint.com/android/android_user_interface_layouts.htm
https://www.tutorialspoint.com/android/android_table_layout.htm
https://data-flair.training/blogs/android-gridlayout/
https://www.tutorialspoint.com/android/android_frame_layout.htm

More Related Content

PPTX
I pad integration ted3000
PDF
Web and App 
Design Fundamental: Quick and dirty tips to improve your UX in n...
PPTX
Usability Audit
PPTX
W1_Lec01_Lec02_Layouts.pptx
PPTX
Android development session 3 - layout
PDF
Mobile Application Development -Lecture 07 & 08.pdf
PDF
Android UI Fundamentals part 1
PPTX
mobile application development -unit-3-
I pad integration ted3000
Web and App 
Design Fundamental: Quick and dirty tips to improve your UX in n...
Usability Audit
W1_Lec01_Lec02_Layouts.pptx
Android development session 3 - layout
Mobile Application Development -Lecture 07 & 08.pdf
Android UI Fundamentals part 1
mobile application development -unit-3-

Similar to Day 4 android bootcamp (20)

DOCX
Android practice of layout in application-chapter6
PPS
Android Workshop
PPT
android layouts
PPTX
UNIT5newpart2pptx__2024_11_13_09_52_11 (1).pptx
PDF
Android ui layout
PPTX
Lecture_On_AndroidApp_UserInterface.pptx
PPTX
INTRODUCTION AND BASICS OF Android NOTES.pptx
PPTX
layout and UI.pptx
PPTX
Android Training (Android UI)
DOCX
How to create ui using droid draw
PPTX
Android User Interface
PPTX
creating User interface in mobile and app dev
PPTX
Android Study Jam 2
PPTX
#7 Android Layouts.pptx
PDF
01 08 - graphical user interface - layouts
PDF
Android UI Development
PPTX
Android Layout.pptx
PDF
Android Screen Containers & Layouts
PPT
Android layouts
PDF
MOBILE APPLICATION DEVELOPMENT
Android practice of layout in application-chapter6
Android Workshop
android layouts
UNIT5newpart2pptx__2024_11_13_09_52_11 (1).pptx
Android ui layout
Lecture_On_AndroidApp_UserInterface.pptx
INTRODUCTION AND BASICS OF Android NOTES.pptx
layout and UI.pptx
Android Training (Android UI)
How to create ui using droid draw
Android User Interface
creating User interface in mobile and app dev
Android Study Jam 2
#7 Android Layouts.pptx
01 08 - graphical user interface - layouts
Android UI Development
Android Layout.pptx
Android Screen Containers & Layouts
Android layouts
MOBILE APPLICATION DEVELOPMENT
Ad

More from FatimaYousif11 (15)

PPTX
Day 2 react bootcamp
PPTX
The concept of vector art
PPTX
CV/resume writing
PPTX
Day 8 sketchware
PPT
Firebase
PDF
Android local databases
PPTX
Day 5 android app code advancement
PPTX
Android app code mediator
PPTX
Android App code starter
PPTX
Android bootcamp-day1
PPTX
Getting started with android development
PPTX
Hello to Kotlin
PPTX
Hacktoberfest slides
PPTX
Info session about dsc
Day 2 react bootcamp
The concept of vector art
CV/resume writing
Day 8 sketchware
Firebase
Android local databases
Day 5 android app code advancement
Android app code mediator
Android App code starter
Android bootcamp-day1
Getting started with android development
Hello to Kotlin
Hacktoberfest slides
Info session about dsc
Ad

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
cuic standard and advanced reporting.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
cuic standard and advanced reporting.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation theory and applications.pdf

Day 4 android bootcamp

  • 1. Android Development BootCamp Day 04 Getting Familiar with Event Handling and Layouts in Android
  • 2. A Little Introduction to Myself... Zainab Khan Final Year Student of B.E Software from MUET. Former DSC Expert Team Member. Interested in Android Development and likes to work on it. Would love to help you guys out with whatever I know. You can connect with me on my: zainabyounus63@gmail.com https://www.facebook.com/zainab.younus.18/ www.linkedin.com/in/zainab-younus-khan
  • 3. What we will be doing today? Look into three layouts of Android UI Development. Which ones? ● Table Layout. ● Grid Layout. ● Frame Layout. While exploring them, you’ll be learning ‘click/event handling’ in Android. Last but no the least, we will try to cooperate with each other with the best of our behaviours yeah? Don’t hesitate to ask a question in chatbox for now, but remember we are going to learn together so I may not be the perfect guru. LET’S LEARN TOGETHER :)
  • 6. Handling Click Events When you press a view (usually button) on your app’s UI, an event gets triggered resulting into some action (preferably the desired one). But how to handle those clicks to get that desired action performed? Well, in Android there are two ways to handle button clicks. Let’s check them out! 1. Using onClick() method. 2. Using onClickListener().
  • 7. 1) Using onClick() method Two steps: 1. Define onClick property of button in XML. 2. Now, handle the view in your Java file.
  • 9. 2) Using onClickListener() As the name suggests, click listeners automatically listens for click events, so you don’t need to explicitly mention an attribute for them in XML. In Java file, Initialize the view (button in this case) and define a click listener for it.
  • 11. What is a Layout? ➔ A layout is something that defines the structure of a user interface in your app, using hierarchies of views and view groups. ➔ It tells how the UI components will be rendered on the screen for the user. Why are Layouts Important? ➔ If you are not putting your views into a particular structure or hierarchy, they will be floating on the screen as they want, which is obviously not required. ➔ Structuring is important prior to designing. ➔ Inefficient use of layouts can frustrate your users, increase confusions, and lead to high performance costs with inefficient use of resources and components.
  • 12. Some Important Layouts Linear Layout. Relative Layout. Table Layout. Absolute Layout. Frame Layout. ListView. Grid Layout. Linear Layout is a view group that aligns all children in a single direction, vertically or horizontally. Relative Layout is a view group that displays child views in relative positions. Table Layout is a view that groups views into rows and columns. Absolute Layout enables you to specify the exact location of its children. The Frame Layout is a placeholder on screen that you can use to display a single view. ListView is a view group that displays a list of scrollable items. Grid Layout is a layout manager that arranges the views in a grid..
  • 13. TABLE LAYOUT ➔ Android TableLayout is going to be arrange groups of views into rows and columns. ➔ You will use the <TableRow> element to build a row in the table. ➔ Each row has zero or more cells; each cell can hold one View object.
  • 14. Grid Layout ➔ In Android GridLayout, we can specify the number of columns and rows that the grid will have. ➔ We can customize the GridLayout according to our requirements, like setting the size, color or the margin for the Layout. ➔ So, a GridLayout basically places its children in a rectangular grid. This grid has a set of a number of thin lines that separate the view area into cells. ➔ Each item in a grid cell can be pointed using its index number.
  • 15. Frame Layout ➔ Frame Layout is designed to block out an area on the screen to display a single item. ➔ Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other. ➔ You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute.
  • 16. Are We DONE? YES? High Five! Ask Away Questions!
  • 17. Some Tips! ★ Try different things if you haven’t. Explore maps, databases, services, broadcasts, AI in android, different layouts, etc. ★ Try to implement SDLC phases. ★ Test your app. You can use automated tools or do it manually (Assure SW Quality) ★ Document even your simplest apps at least with a paragraph long description, along with some screenshots or short screen recordings. ★ Upload them on Github PLEASE! ★ Make your LinkedIn profile and try to do things that can be fitted into it. ★ Make your Resume. ★ Make connections. ★ Participate in Coding Expos and Project Exhibitions. ★ MUST do internships of at least 3-4 weeks, in interested areas. ★ Go Native! ★ DON’T WASTE YOUR MONEY ON USELESS EVENTS. Other than the ones which teach you something you don’t know, and can have a place in your experience count. ★ Join Communities and related groups. ★ Stay Connected and HELP each other :)