Filtrelenen ListView'ümün güncellenmemesi ile ilgili bir sorunla karşılaşıyorum.Liste görünümüm neden güncellenmiyor?
Uygulamamda, iki TextView ve bir ImageView öğesi bir satır öğesi olan özel bir ListView var.
Filtre düzgün çalışıyor ancak özel ListView'üm publishResults()
numaralı telefondan güncellenmiyor.
@Override
protected FilterResults performFiltering(CharSequence constraint)
{
FilterResults results = new FilterResults();
if (constraint == null || constraint.length() <= 0) {
results.count = ListAdapter.this.mStringFilterList.size();
results.values = ListAdapter.this.mStringFilterList;
} else {
ArrayList<Ezomart> filterList = new ArrayList();
for (int i = 0; i < ListAdapter.this.mStringFilterList.size(); i++) {
if (((Ezomart) ListAdapter.this.mStringFilterList.get(i)).getTitle().toUpperCase().contains(constraint.toString().toUpperCase())) {
Ezomart country = new Ezomart();
country.setTitle(((Ezomart)ListAdapter.this.mStringFilterList.get(i)).getTitle());
Log.d("SRI",mStringFilterList.get(i).getTitle());
country.setSubCategory(((Ezomart) ListAdapter.this.mStringFilterList.get(i)).getSubCategory());
country.setArea(((Ezomart) ListAdapter.this.mStringFilterList.get(i)).getArea());
country.setThumbnailUrl(((Ezomart) ListAdapter.this.mStringFilterList.get(i)).getThumbnailUrl());
country.setNumber(((Ezomart) ListAdapter.this.mStringFilterList.get(i)).getNumber());
filterList.add(country);
}
}
results.count = filterList.size();
results.values = filterList;
}
return results;
}
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
ListAdapter.this.ezoItems = (List<Ezomart>) filterResults.values;
if (filterResults.count > 0) {
notifyDataSetChanged();
} else {
notifyDataSetInvalidated();
}
}
bilmiyorum: Referans olarak
bağlantıyı takip edin. Filtrelenebilir uygulandığında, yayınlama sonuçlarını otomatik olarak aramalı. – Srikanth86in
Bu kodun verildiği sınıfın adı nedir? 'NotifyDataSetChanged() '' 'ClassName.this.notifyDataSetChanged()' ' – jensbrulmans
' ı da değiştirmeyi deneyin, ayrıca' publishResults() 'geçersiz kılılmamalıdır? ('@ Override') – jensbrulmans