SlideShare ist ein Scribd-Unternehmen logo
1 von 16
AdapterView
& Adapters
Android Training
By Khaled Anaqwa
AdapterView





The AdapterView is a ViewGroup subclass
whose child Views are determined by an
Adapter that binds AdapterView object to
data of some type.
Typically you are going to use subsclasses of
AdapterView class instead of using it directly
Example subclasses of AdapterView class




ListView
Spinner
Gallery
Adapter
 You

can populate an AdapterView such
as ListView or GridView by binding the
AdapterView instance to an Adapter,
which retrieves data from an external
source and creates a View that
represents each data entry.
AdapterView & Adapters
So
 The

Adapter provides access to the data
items.
 The Adapter is also responsible for making
a View for each item in the data set.
 Types of Adatpers - they implements
ListAdatper interface




ArrayAdatper
CursorAdatper
There are a few more
Adapter Class Hierarchy
 BaseAdatper

abstract class implements
ListAdapter and SpinnerAdatper
interfaces
 ArrayAdapter and CursorAdapter classes
are subclasses of BaseAdapter class
AdapterView Responsibilities
 Two



main responsibilities of AdapterView

Filling the layout with data (with a help from
Adapter)
Handling user selections - when a user
selects an item, perform some action
 AdapterView.OnItemClickListener
 AdapterView.OnItemLongClickListener
 AdapterView.OnItemSelectedListener
ListActivity








Android-provided class specially designed for
displaying a list of items by binding to a data
source such as an array or Cursor, and exposes
event handlers when the user selects an item.
ListActivity hosts a ListView object that can be
bound through an adatper to different data
sources, typically either an array or a Cursor
holding query results.
setListAdapter(ListAdatper adapter) method
automatically creates ListView object from the
ListAdapter object
Has a default layout that consists of a single, fullscreen list in the center of the screen
Example
 List

of COUNTRIES
 Notice

that this does not load a layout file
for the Activity (which you usually do with
setContentView(int)).
 setListAdapter(ListAdapter) automatically
adds a ListView to fill the entire screen of
the ListActivity.
What is the difference
between a ListView and a
ScrollView ?
Simply
 ScrollView

a host for “static” content and
a ListView a host for “dynamic” content.
Listview
 ListView

is a view group that displays a list
of scrollable items. The list items are
automatically inserted to the list using an
Adapter that pulls content from a source
such as an array or database query and
converts each item result into a view
that's placed into the list.
Spinner
A

view that displays one child at a time
and lets the user pick among them.
 The items in the Spinner come from the
Adapter associated with this view.
Example
 Choose

one of COUNTRIES
In ArrayAdapter


Data updates





The ArrayAdapter class allows to remove all
elements in its underlying data structure with the
clear() method call.
You can then add new elements via the add()
method or a Collection via the addAll() method.
You can also directly modify the underlying data
structure and call the notifyDataSetChanged()
method on the adapter to notify him about the
changes in data.

Weitere ähnliche Inhalte

Was ist angesagt?

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
 
Creating EPiServer Usage Reports
Creating EPiServer Usage ReportsCreating EPiServer Usage Reports
Creating EPiServer Usage ReportsPaul Graham
 
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
 
AutocompleteTextView And MultiAutoCompleteTextView
AutocompleteTextView And MultiAutoCompleteTextViewAutocompleteTextView And MultiAutoCompleteTextView
AutocompleteTextView And MultiAutoCompleteTextViewSourabh Sahu
 
Search syntax training
Search syntax trainingSearch syntax training
Search syntax trainingDavidPixton
 
Adrotator in asp
Adrotator in aspAdrotator in asp
Adrotator in aspSireesh K
 
ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image SlideshowHock Leng PUAH
 

Was ist angesagt? (10)

List adapter with multiple objects
List adapter with multiple objectsList adapter with multiple objects
List adapter with multiple objects
 
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
 
Isotope.js
Isotope.jsIsotope.js
Isotope.js
 
Creating EPiServer Usage Reports
Creating EPiServer Usage ReportsCreating EPiServer Usage Reports
Creating EPiServer Usage Reports
 
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
 
AutocompleteTextView And MultiAutoCompleteTextView
AutocompleteTextView And MultiAutoCompleteTextViewAutocompleteTextView And MultiAutoCompleteTextView
AutocompleteTextView And MultiAutoCompleteTextView
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
 
Search syntax training
Search syntax trainingSearch syntax training
Search syntax training
 
Adrotator in asp
Adrotator in aspAdrotator in asp
Adrotator in asp
 
ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image Slideshow
 

Andere mochten auch

Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & AdapterLope Emano
 
Android tutorial points
Android tutorial pointsAndroid tutorial points
Android tutorial pointsbsb_2209
 
Android Training - View Pager
Android Training - View PagerAndroid Training - View Pager
Android Training - View PagerKan-Han (John) Lu
 
Adapter and cache technique
Adapter and cache techniqueAdapter and cache technique
Adapter and cache techniqueHoang Vy Nguyen
 
Android sync adapter
Android sync adapterAndroid sync adapter
Android sync adapterAlex Tumanoff
 
Android content providers
Android content providersAndroid content providers
Android content providersKurt Mbanje
 
Android Session 6 - UI Part 1
Android Session 6 - UI Part 1Android Session 6 - UI Part 1
Android Session 6 - UI Part 1Paramvir Singh
 
Journey of an event, the android touch - Marco Cova, Facebook
Journey of an event, the android touch - Marco Cova, FacebookJourney of an event, the android touch - Marco Cova, Facebook
Journey of an event, the android touch - Marco Cova, FacebookDroidConTLV
 
Content providers in Android
Content providers in AndroidContent providers in Android
Content providers in AndroidAlexey Ustenko
 
Tech Talk #2: Android app performance tips
Tech Talk #2: Android app performance tipsTech Talk #2: Android app performance tips
Tech Talk #2: Android app performance tipsNexus FrontierTech
 
android design pattern
android design patternandroid design pattern
android design patternLucas Xu
 
Adapter & ListView & ExpandalbeListView
Adapter & ListView & ExpandalbeListViewAdapter & ListView & ExpandalbeListView
Adapter & ListView & ExpandalbeListViewYuki Anzai
 
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
 
Mastering RecyclerView Layouts
Mastering RecyclerView LayoutsMastering RecyclerView Layouts
Mastering RecyclerView LayoutsDave Smith
 

Andere mochten auch (19)

Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & Adapter
 
Android tutorial points
Android tutorial pointsAndroid tutorial points
Android tutorial points
 
Android Training - View Pager
Android Training - View PagerAndroid Training - View Pager
Android Training - View Pager
 
Adapter and cache technique
Adapter and cache techniqueAdapter and cache technique
Adapter and cache technique
 
Android sync adapter
Android sync adapterAndroid sync adapter
Android sync adapter
 
Android ui part 2
Android ui part 2Android ui part 2
Android ui part 2
 
Android content providers
Android content providersAndroid content providers
Android content providers
 
Android Session 6 - UI Part 1
Android Session 6 - UI Part 1Android Session 6 - UI Part 1
Android Session 6 - UI Part 1
 
Android Custom view
Android Custom view Android Custom view
Android Custom view
 
Journey of an event, the android touch - Marco Cova, Facebook
Journey of an event, the android touch - Marco Cova, FacebookJourney of an event, the android touch - Marco Cova, Facebook
Journey of an event, the android touch - Marco Cova, Facebook
 
Content providers in Android
Content providers in AndroidContent providers in Android
Content providers in Android
 
Fun with RecyclerView
Fun with RecyclerViewFun with RecyclerView
Fun with RecyclerView
 
Tech Talk #2: Android app performance tips
Tech Talk #2: Android app performance tipsTech Talk #2: Android app performance tips
Tech Talk #2: Android app performance tips
 
Recyclerview in action
Recyclerview in action Recyclerview in action
Recyclerview in action
 
android design pattern
android design patternandroid design pattern
android design pattern
 
Bonnes pratiques développement android
Bonnes pratiques développement androidBonnes pratiques développement android
Bonnes pratiques développement android
 
Adapter & ListView & ExpandalbeListView
Adapter & ListView & ExpandalbeListViewAdapter & ListView & ExpandalbeListView
Adapter & ListView & ExpandalbeListView
 
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]
 
Mastering RecyclerView Layouts
Mastering RecyclerView LayoutsMastering RecyclerView Layouts
Mastering RecyclerView Layouts
 

Ähnlich wie Android Training (AdapterView & Adapter)

Grid View- GridView is a ViewGroup that displays items in a two d.pdf
Grid View- GridView is a ViewGroup that displays items in a two d.pdfGrid View- GridView is a ViewGroup that displays items in a two d.pdf
Grid View- GridView is a ViewGroup that displays items in a two d.pdfdeepua8
 
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 5 android app code advancement
Day 5  android app code advancementDay 5  android app code advancement
Day 5 android app code advancementFatimaYousif11
 
ListView RecyclerView.pptx
ListView RecyclerView.pptxListView RecyclerView.pptx
ListView RecyclerView.pptxOmakoiMalang
 
Android Training Session 1
Android Training Session 1Android Training Session 1
Android Training Session 1Shanmugapriya D
 
Android tutorials8 todo_list
Android tutorials8 todo_listAndroid tutorials8 todo_list
Android tutorials8 todo_listVlad Kolesnyk
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfacesC.o. Nieto
 
Murach: How to transfer data from controllers
Murach: How to transfer data from controllersMurach: How to transfer data from controllers
Murach: How to transfer data from controllersMahmoudOHassouna
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionssuseredfbe9
 
How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)Giuseppe Filograno
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
TKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom AdapterTKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom AdapterXavier Yin
 

Ähnlich wie Android Training (AdapterView & Adapter) (20)

Grid View- GridView is a ViewGroup that displays items in a two d.pdf
Grid View- GridView is a ViewGroup that displays items in a two d.pdfGrid View- GridView is a ViewGroup that displays items in a two d.pdf
Grid View- GridView is a ViewGroup that displays items in a two d.pdf
 
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 5 android app code advancement
Day 5  android app code advancementDay 5  android app code advancement
Day 5 android app code advancement
 
Lab2-android
Lab2-androidLab2-android
Lab2-android
 
ListView RecyclerView.pptx
ListView RecyclerView.pptxListView RecyclerView.pptx
ListView RecyclerView.pptx
 
Android Ui
Android UiAndroid Ui
Android Ui
 
Android UI
Android UI Android UI
Android UI
 
Hello Android
Hello AndroidHello Android
Hello Android
 
Android Training Session 1
Android Training Session 1Android Training Session 1
Android Training Session 1
 
Session 2- day 3
Session 2- day 3Session 2- day 3
Session 2- day 3
 
Android tutorials8 todo_list
Android tutorials8 todo_listAndroid tutorials8 todo_list
Android tutorials8 todo_list
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Murach: How to transfer data from controllers
Murach: How to transfer data from controllersMurach: How to transfer data from controllers
Murach: How to transfer data from controllers
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
 
List view3
List view3List view3
List view3
 
Android development session 3 - layout
Android development   session 3 - layoutAndroid development   session 3 - layout
Android development session 3 - layout
 
How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)
 
List view1
List view1List view1
List view1
 
View groups containers
View groups containersView groups containers
View groups containers
 
TKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom AdapterTKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom Adapter
 

Mehr von Khaled Anaqwa

Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Khaled Anaqwa
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)Khaled Anaqwa
 
Android Training (Services)
Android Training (Services)Android Training (Services)
Android Training (Services)Khaled Anaqwa
 
Android Training (Notifications)
Android Training (Notifications)Android Training (Notifications)
Android Training (Notifications)Khaled Anaqwa
 
Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)Khaled Anaqwa
 
Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Khaled Anaqwa
 
Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)Khaled Anaqwa
 
Android Training (Touch)
Android Training (Touch)Android Training (Touch)
Android Training (Touch)Khaled Anaqwa
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)Khaled Anaqwa
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)Khaled Anaqwa
 
Android Training (ScrollView , Horizontal ScrollView WebView)
Android Training (ScrollView , Horizontal ScrollView  WebView)Android Training (ScrollView , Horizontal ScrollView  WebView)
Android Training (ScrollView , Horizontal ScrollView WebView)Khaled Anaqwa
 
Android training (android style)
Android training (android style)Android training (android style)
Android training (android style)Khaled Anaqwa
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)Khaled Anaqwa
 
Android Training (Intro)
Android Training (Intro)Android Training (Intro)
Android Training (Intro)Khaled Anaqwa
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)Khaled Anaqwa
 
Android Training (android fundamental)
Android Training (android fundamental)Android Training (android fundamental)
Android Training (android fundamental)Khaled Anaqwa
 

Mehr von Khaled Anaqwa (16)

Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
 
Android Training (Services)
Android Training (Services)Android Training (Services)
Android Training (Services)
 
Android Training (Notifications)
Android Training (Notifications)Android Training (Notifications)
Android Training (Notifications)
 
Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)
 
Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)
 
Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)
 
Android Training (Touch)
Android Training (Touch)Android Training (Touch)
Android Training (Touch)
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)
 
Android Training (ScrollView , Horizontal ScrollView WebView)
Android Training (ScrollView , Horizontal ScrollView  WebView)Android Training (ScrollView , Horizontal ScrollView  WebView)
Android Training (ScrollView , Horizontal ScrollView WebView)
 
Android training (android style)
Android training (android style)Android training (android style)
Android training (android style)
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Android Training (Intro)
Android Training (Intro)Android Training (Intro)
Android Training (Intro)
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 
Android Training (android fundamental)
Android Training (android fundamental)Android Training (android fundamental)
Android Training (android fundamental)
 

Kürzlich hochgeladen

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Android Training (AdapterView & Adapter)

  • 2. AdapterView    The AdapterView is a ViewGroup subclass whose child Views are determined by an Adapter that binds AdapterView object to data of some type. Typically you are going to use subsclasses of AdapterView class instead of using it directly Example subclasses of AdapterView class    ListView Spinner Gallery
  • 3. Adapter  You can populate an AdapterView such as ListView or GridView by binding the AdapterView instance to an Adapter, which retrieves data from an external source and creates a View that represents each data entry.
  • 5. So  The Adapter provides access to the data items.  The Adapter is also responsible for making a View for each item in the data set.  Types of Adatpers - they implements ListAdatper interface    ArrayAdatper CursorAdatper There are a few more
  • 6. Adapter Class Hierarchy  BaseAdatper abstract class implements ListAdapter and SpinnerAdatper interfaces  ArrayAdapter and CursorAdapter classes are subclasses of BaseAdapter class
  • 7. AdapterView Responsibilities  Two   main responsibilities of AdapterView Filling the layout with data (with a help from Adapter) Handling user selections - when a user selects an item, perform some action  AdapterView.OnItemClickListener  AdapterView.OnItemLongClickListener  AdapterView.OnItemSelectedListener
  • 8. ListActivity     Android-provided class specially designed for displaying a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item. ListActivity hosts a ListView object that can be bound through an adatper to different data sources, typically either an array or a Cursor holding query results. setListAdapter(ListAdatper adapter) method automatically creates ListView object from the ListAdapter object Has a default layout that consists of a single, fullscreen list in the center of the screen
  • 10.  Notice that this does not load a layout file for the Activity (which you usually do with setContentView(int)).  setListAdapter(ListAdapter) automatically adds a ListView to fill the entire screen of the ListActivity.
  • 11. What is the difference between a ListView and a ScrollView ?
  • 12. Simply  ScrollView a host for “static” content and a ListView a host for “dynamic” content.
  • 13. Listview  ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into the list.
  • 14. Spinner A view that displays one child at a time and lets the user pick among them.  The items in the Spinner come from the Adapter associated with this view.
  • 16. In ArrayAdapter  Data updates    The ArrayAdapter class allows to remove all elements in its underlying data structure with the clear() method call. You can then add new elements via the add() method or a Collection via the addAll() method. You can also directly modify the underlying data structure and call the notifyDataSetChanged() method on the adapter to notify him about the changes in data.

Hinweis der Redaktion

  1. public class HelloListView extends ListActivity { static final String[] COUNTRIES = new String[] { ”Palestine", ”Jordan", ”Sudan", ”Egypt" }; /** Called when the activity is first created. */ @Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create an adapterArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>( this, // Application contextR.layout.list_item, // layout description for each list item COUNTRIES); // String array of countries defined setListAdapter(arrayAdapter); }}
  2. For example, you may use a ScrollView to display a graphical user interface larger then the actual screen. The GUI is static in the sense that its content will never change, and the reason to use a ScrollView is to access all the widgets on the GUI. On the other hand consider the contacts list on your android phone, if you access it you will get a list of contacts, if you delete a contact and reopen it, you will get a different list of contacts. For that reason the ListView displays dynamic content.
  3. public class MyAndroidAppActivity extends Activity { private Spinner spinner1; @Override public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);static final String[] COUNTRIES = new String[] { ”Palestine", ”Jordan", ”Sudan", ”Egypt" };spinner1 = (Spinner) findViewById(R.id.spinner1);ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, COUNTRIES );dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);spinner.setAdapter(dataAdapter); }}