SlideShare a Scribd company logo
1 of 7
ACADGILDACADGILD
INTRODUCTION:
It is very simple to make a ListView but a custom ListView contains so much data in a row like image,
text, buttons etc. according to need of an application and if our ListView is very long then there is need
to add a filter option for user to choose an item in a list easily.
To filter the Custom ListView we have to add an input field where the user can insert the keys to filter
the ListView.
Methods & Classes:
Methods:
getView(): To inflate the row data of ListView this method is called.
getFilter(): This method is overrided when we implement the Filterable interface and it returns the
new filter.
Classes:
Here we create a private class i.e ValueFilter inside our custom adapter class and extends
with Filter class to perform the filter operation.
Filter has two major components i.e performFiltering(..) method and publishResults(..) method.
performFiltering() method creates a new Arraylist with filtered data.
publishResults() method is for notify data set changed.
Real Time Example:
Android gives the feature of filter option in Phone application to filter a particular name.And in
various application this feature is used like in this example.
Example with Code:
Here you see How to implement filter custom ListView in Android.
These are the steps:
1.Create a new Application FilteringCustomListViewAndroid.
2.2 XML Layout files are needed for it.
3.Two String array is need to be implement.XML Layout files:
1.activity_main.xml : add the searchview and listview inside this.
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
<!-- Editext for Search -->
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/search_view_border"
android:iconifiedByDefault="false"
android:padding="2dp"
android:queryHint="Search...." />
<!-- ListView -->
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
2. list_item.xml : It shows the row data add imageview and textview inside this.
<ImageView
android:id="@+id/ivbaby"
android:layout_width="80dp"
android:layout_height="70dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/tvname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/ivbaby"
android:paddingBottom="10dp"
android:textColor="#000000"
android:textSize="20sp" />
BabyDetailsData class:
Create a class model BabyDetailsData and implements its setter’s getters for row data of each items of
ListView. i.e.
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
public class BabyDetailsData {
String babyname;
int babypicture;
public BabyDetailsData(String babyname, int babypicture) {
super();
this.babyname = babyname;
this.babypicture = babypicture;
}
public String getBabyname() {
return babyname;
}
public void setBabyname(String babyname) {
this.babyname = babyname;
}
public int getBabypicture() {
return babypicture;
}
public void setBabypicture(int babypicture) {
this.babypicture = babypicture;
}
CustomListViewAdapter class:
As I discussed above, here we implement Filterable interface and override the getfilter() method.
Create ValueFilter class inside it.
private class ValueFilter extends Filter{
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
if (constraint != null && constraint.length() > 0) {
ArrayList<BabyDetailsData> filterList = new ArrayList<BabyDetailsData>();
for (int i = 0; i < mStringFilterList.size(); i++) {
if ((mStringFilterList.get(i).getBabyname().toUpperCase())
.contains(constraint.toString().toUpperCase())) {
BabyDetailsData babydata = new BabyDetailsData(mStringFilterList.get(i)
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
.getBabyname(), mStringFilterList.get(i)
.getBabypicture());
filterList.add(babydata);
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = mStringFilterList.size();
results.values = mStringFilterList;
}
return results;
}
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
babylist = (ArrayList<BabyDetailsData>) results.values;
notifyDataSetChanged();
}
}
Strings.xml:
<string-array name="baby_names">
<item>Andrew</item>
<item>Benjamin</item>
<item>Christopher</item>
<item>Daniel</item>
<item>Ethan</item>
<item>Isabella</item>
<item>Joseph</item>
<item>Lily</item>
<item>Matthew</item>
<item>Michael</item>
<item>William</item>
</string-array>
<array name="baby_pictures">
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
<item>@drawable/andrew</item>
<item>@drawable/benjamin</item>
<item>@drawable/christopher</item>
<item>@drawable/daniel</item>
<item>@drawable/ethan</item>
<item>@drawable/isabella</item>
<item>@drawable/joseph</item>
<item>@drawable/lily</item>
<item>@drawable/matthew</item>
<item>@drawable/michael</item>
<item>@drawable/william</item>
</array>
MainActivity class:
Implement SearchView.OnQueryTextListener interface and override its
methods onQueryTextChange()and onQueryTextSubmit().
Initialize SearchView:
SearchView searchview;
Add code in onCreate(){..}
searchview = (SearchView) findViewById(R.id.search_view);
babynames = getResources().getStringArray(R.array.baby_names);
babypictures = getResources().obtainTypedArray(R.array.baby_pictures);
Create some code in onQueryTextChange() method :
@Override
public boolean onQueryTextChange(String newText) {
adapter.getFilter().filter(newText);
return false;
}
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
OUTPUT:
CONCLUSION:
This is the basic idea of how to filter custom ListView.It is nothing just to add the SearchView for the
user to insert the keys to filter data inside the list.It is used in many application like I give the example
of phone application.We can also customize the SearchView according to the need.This feature is very
popular in android development.
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
ACADGILDACADGILD
OUTPUT:
CONCLUSION:
This is the basic idea of how to filter custom ListView.It is nothing just to add the SearchView for the
user to insert the keys to filter data inside the list.It is used in many application like I give the example
of phone application.We can also customize the SearchView according to the need.This feature is very
popular in android development.
https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/

More Related Content

What's hot

Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptxvishal choudhary
 
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
 
Android content provider explained
Android content provider explainedAndroid content provider explained
Android content provider explainedShady Selim
 
Android styles and themes
Android styles and themesAndroid styles and themes
Android styles and themesSourabh Sahu
 
Has Many And Belongs To Many
Has Many And Belongs To ManyHas Many And Belongs To Many
Has Many And Belongs To Manyguest80d303
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentproviderKrazy Koder
 
Personalizations for control deliver to organizations in Purchase Requisition...
Personalizations for control deliver to organizations in Purchase Requisition...Personalizations for control deliver to organizations in Purchase Requisition...
Personalizations for control deliver to organizations in Purchase Requisition...Ahmed Elshayeb
 
Ivanti Cheat Sheet by Traversys Limited
Ivanti Cheat Sheet by Traversys LimitedIvanti Cheat Sheet by Traversys Limited
Ivanti Cheat Sheet by Traversys LimitedTim Read
 
Android ListView and Custom ListView
Android ListView and Custom ListView Android ListView and Custom ListView
Android ListView and Custom ListView Sourabh Sahu
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesArvind Krishnaa
 
Dependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksDependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksAntya Dev
 
E2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3.org
 
05 content providers - Android
05   content providers - Android05   content providers - Android
05 content providers - AndroidWingston
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTechAntya Dev
 
Session 8 connect your universal application with database .. builders & deve...
Session 8 connect your universal application with database .. builders & deve...Session 8 connect your universal application with database .. builders & deve...
Session 8 connect your universal application with database .. builders & deve...Moatasim Magdy
 
Classic asp , VB.net insert update delete crud
Classic asp , VB.net insert update delete crudClassic asp , VB.net insert update delete crud
Classic asp , VB.net insert update delete crudParakram Chavda
 

What's hot (20)

Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptx
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
Android - Saving data
Android - Saving dataAndroid - Saving data
Android - Saving data
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Android content provider explained
Android content provider explainedAndroid content provider explained
Android content provider explained
 
Android styles and themes
Android styles and themesAndroid styles and themes
Android styles and themes
 
Has Many And Belongs To Many
Has Many And Belongs To ManyHas Many And Belongs To Many
Has Many And Belongs To Many
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentprovider
 
Personalizations for control deliver to organizations in Purchase Requisition...
Personalizations for control deliver to organizations in Purchase Requisition...Personalizations for control deliver to organizations in Purchase Requisition...
Personalizations for control deliver to organizations in Purchase Requisition...
 
Ivanti Cheat Sheet by Traversys Limited
Ivanti Cheat Sheet by Traversys LimitedIvanti Cheat Sheet by Traversys Limited
Ivanti Cheat Sheet by Traversys Limited
 
Android ListView and Custom ListView
Android ListView and Custom ListView Android ListView and Custom ListView
Android ListView and Custom ListView
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View Classes
 
Share preference
Share preferenceShare preference
Share preference
 
Dependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksDependency rejection and TDD without Mocks
Dependency rejection and TDD without Mocks
 
E2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API Instruction
 
05 content providers - Android
05   content providers - Android05   content providers - Android
05 content providers - Android
 
Active record(1)
Active record(1)Active record(1)
Active record(1)
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTech
 
Session 8 connect your universal application with database .. builders & deve...
Session 8 connect your universal application with database .. builders & deve...Session 8 connect your universal application with database .. builders & deve...
Session 8 connect your universal application with database .. builders & deve...
 
Classic asp , VB.net insert update delete crud
Classic asp , VB.net insert update delete crudClassic asp , VB.net insert update delete crud
Classic asp , VB.net insert update delete crud
 

Similar to ACADGILD:: ANDROID LESSON

1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docxhoney725342
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Learn about dot net attributes
Learn about dot net attributesLearn about dot net attributes
Learn about dot net attributessonia merchant
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In PyEric ShangKuan
 
UI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelUI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelPatric Ksinsik
 
Ruby on rails
Ruby on rails Ruby on rails
Ruby on rails Mohit Jain
 
Leverage StandardSetController in Apex and Visualforce
Leverage StandardSetController in Apex and VisualforceLeverage StandardSetController in Apex and Visualforce
Leverage StandardSetController in Apex and VisualforceSalesforce Developers
 
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
 
Android App To Display Employee Details
Android App To Display Employee DetailsAndroid App To Display Employee Details
Android App To Display Employee DetailsSaikrishna Tanguturu
 
Android Database Tutorial
Android Database TutorialAndroid Database Tutorial
Android Database TutorialPerfect APK
 
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...Inhacking
 

Similar to ACADGILD:: ANDROID LESSON (20)

Lab2-android
Lab2-androidLab2-android
Lab2-android
 
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Android sql examples
Android sql examplesAndroid sql examples
Android sql examples
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Learn about dot net attributes
Learn about dot net attributesLearn about dot net attributes
Learn about dot net attributes
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
Grails Advanced
Grails Advanced Grails Advanced
Grails Advanced
 
Eclipse Tricks
Eclipse TricksEclipse Tricks
Eclipse Tricks
 
UI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelUI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 Model
 
Comilla University
Comilla University Comilla University
Comilla University
 
Ruby on rails
Ruby on rails Ruby on rails
Ruby on rails
 
Leverage StandardSetController in Apex and Visualforce
Leverage StandardSetController in Apex and VisualforceLeverage StandardSetController in Apex and Visualforce
Leverage StandardSetController in Apex and Visualforce
 
Android list view tutorial by Javatechig
Android list view tutorial by JavatechigAndroid list view tutorial by Javatechig
Android list view tutorial by Javatechig
 
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
 
Android App To Display Employee Details
Android App To Display Employee DetailsAndroid App To Display Employee Details
Android App To Display Employee Details
 
Data Binding
Data BindingData Binding
Data Binding
 
Android Database Tutorial
Android Database TutorialAndroid Database Tutorial
Android Database Tutorial
 
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
 

More from Padma shree. T

ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on railsACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on railsPadma shree. T
 
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...Padma shree. T
 
ACADGILD:: HADOOP LESSON - File formats in apache hive
ACADGILD:: HADOOP LESSON - File formats in apache hiveACADGILD:: HADOOP LESSON - File formats in apache hive
ACADGILD:: HADOOP LESSON - File formats in apache hivePadma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
ACADILD:: HADOOP LESSON
ACADILD:: HADOOP LESSON ACADILD:: HADOOP LESSON
ACADILD:: HADOOP LESSON Padma shree. T
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 

More from Padma shree. T (10)

ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on railsACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
 
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze &amp; manage memory on android like ...
 
ACADGILD:: HADOOP LESSON - File formats in apache hive
ACADGILD:: HADOOP LESSON - File formats in apache hiveACADGILD:: HADOOP LESSON - File formats in apache hive
ACADGILD:: HADOOP LESSON - File formats in apache hive
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
ACADILD:: HADOOP LESSON
ACADILD:: HADOOP LESSON ACADILD:: HADOOP LESSON
ACADILD:: HADOOP LESSON
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 

Recently uploaded

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
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
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 

Recently uploaded (20)

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
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
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
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

ACADGILD:: ANDROID LESSON

  • 1. ACADGILDACADGILD INTRODUCTION: It is very simple to make a ListView but a custom ListView contains so much data in a row like image, text, buttons etc. according to need of an application and if our ListView is very long then there is need to add a filter option for user to choose an item in a list easily. To filter the Custom ListView we have to add an input field where the user can insert the keys to filter the ListView. Methods & Classes: Methods: getView(): To inflate the row data of ListView this method is called. getFilter(): This method is overrided when we implement the Filterable interface and it returns the new filter. Classes: Here we create a private class i.e ValueFilter inside our custom adapter class and extends with Filter class to perform the filter operation. Filter has two major components i.e performFiltering(..) method and publishResults(..) method. performFiltering() method creates a new Arraylist with filtered data. publishResults() method is for notify data set changed. Real Time Example: Android gives the feature of filter option in Phone application to filter a particular name.And in various application this feature is used like in this example. Example with Code: Here you see How to implement filter custom ListView in Android. These are the steps: 1.Create a new Application FilteringCustomListViewAndroid. 2.2 XML Layout files are needed for it. 3.Two String array is need to be implement.XML Layout files: 1.activity_main.xml : add the searchview and listview inside this. https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 2. ACADGILDACADGILD <!-- Editext for Search --> <SearchView android:id="@+id/search_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/search_view_border" android:iconifiedByDefault="false" android:padding="2dp" android:queryHint="Search...." /> <!-- ListView --> <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="match_parent" /> 2. list_item.xml : It shows the row data add imageview and textview inside this. <ImageView android:id="@+id/ivbaby" android:layout_width="80dp" android:layout_height="70dp" android:paddingLeft="10dp" android:paddingRight="10dp" /> <TextView android:id="@+id/tvname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:layout_toRightOf="@+id/ivbaby" android:paddingBottom="10dp" android:textColor="#000000" android:textSize="20sp" /> BabyDetailsData class: Create a class model BabyDetailsData and implements its setter’s getters for row data of each items of ListView. i.e. https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 3. ACADGILDACADGILD public class BabyDetailsData { String babyname; int babypicture; public BabyDetailsData(String babyname, int babypicture) { super(); this.babyname = babyname; this.babypicture = babypicture; } public String getBabyname() { return babyname; } public void setBabyname(String babyname) { this.babyname = babyname; } public int getBabypicture() { return babypicture; } public void setBabypicture(int babypicture) { this.babypicture = babypicture; } CustomListViewAdapter class: As I discussed above, here we implement Filterable interface and override the getfilter() method. Create ValueFilter class inside it. private class ValueFilter extends Filter{ @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); if (constraint != null && constraint.length() > 0) { ArrayList<BabyDetailsData> filterList = new ArrayList<BabyDetailsData>(); for (int i = 0; i < mStringFilterList.size(); i++) { if ((mStringFilterList.get(i).getBabyname().toUpperCase()) .contains(constraint.toString().toUpperCase())) { BabyDetailsData babydata = new BabyDetailsData(mStringFilterList.get(i) https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 4. ACADGILDACADGILD .getBabyname(), mStringFilterList.get(i) .getBabypicture()); filterList.add(babydata); } } results.count = filterList.size(); results.values = filterList; } else { results.count = mStringFilterList.size(); results.values = mStringFilterList; } return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { babylist = (ArrayList<BabyDetailsData>) results.values; notifyDataSetChanged(); } } Strings.xml: <string-array name="baby_names"> <item>Andrew</item> <item>Benjamin</item> <item>Christopher</item> <item>Daniel</item> <item>Ethan</item> <item>Isabella</item> <item>Joseph</item> <item>Lily</item> <item>Matthew</item> <item>Michael</item> <item>William</item> </string-array> <array name="baby_pictures"> https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 5. ACADGILDACADGILD <item>@drawable/andrew</item> <item>@drawable/benjamin</item> <item>@drawable/christopher</item> <item>@drawable/daniel</item> <item>@drawable/ethan</item> <item>@drawable/isabella</item> <item>@drawable/joseph</item> <item>@drawable/lily</item> <item>@drawable/matthew</item> <item>@drawable/michael</item> <item>@drawable/william</item> </array> MainActivity class: Implement SearchView.OnQueryTextListener interface and override its methods onQueryTextChange()and onQueryTextSubmit(). Initialize SearchView: SearchView searchview; Add code in onCreate(){..} searchview = (SearchView) findViewById(R.id.search_view); babynames = getResources().getStringArray(R.array.baby_names); babypictures = getResources().obtainTypedArray(R.array.baby_pictures); Create some code in onQueryTextChange() method : @Override public boolean onQueryTextChange(String newText) { adapter.getFilter().filter(newText); return false; } https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 6. ACADGILDACADGILD OUTPUT: CONCLUSION: This is the basic idea of how to filter custom ListView.It is nothing just to add the SearchView for the user to insert the keys to filter data inside the list.It is used in many application like I give the example of phone application.We can also customize the SearchView according to the need.This feature is very popular in android development. https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/
  • 7. ACADGILDACADGILD OUTPUT: CONCLUSION: This is the basic idea of how to filter custom ListView.It is nothing just to add the SearchView for the user to insert the keys to filter data inside the list.It is used in many application like I give the example of phone application.We can also customize the SearchView according to the need.This feature is very popular in android development. https://acadgild.com/blog/custom-listview-filter-example-android/https://acadgild.com/blog/custom-listview-filter-example-android/