android - How to filter only the Brandname in my custom adapter without using Viewholder? -


i'm creating android application has custom listview , custom listview adapter. how can filter brandname using custom listview adapter without using viewholder? possible? if is, how can filter it?

import java.util.arraylist; import java.util.hashmap;  import android.content.context; import android.content.intent; import android.graphics.color; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview;  public class listviewadapter extends baseadapter {  // declare variables context context; layoutinflater inflater; arraylist<hashmap<string, string>> data;  imageloader imageloader; hashmap<string, string> resultp = new hashmap<string, string>();  public listviewadapter(context context,                    arraylist<hashmap<string, string>> arraylist) { this.context = context; data = arraylist; imageloader = new imageloader(context); }  @override public int getcount() { return data.size(); }  @override public object getitem(int position) { return null; }  @override public long getitemid(int position) { return 0; }  public view getview(final int position, view convertview, viewgroup parent) { // declare variables textview brand; textview category; textview code; textview description; textview price; textview availability; imageview image;  inflater = (layoutinflater) context         .getsystemservice(context.layout_inflater_service);  view itemview = inflater.inflate(r.layout.activity_main, parent, false); // position resultp = data.get(position);  // locate textviews in listview_item.xml brand = (textview) itemview.findviewbyid(r.id.brand); category = (textview) itemview.findviewbyid(r.id.category); code = (textview) itemview.findviewbyid(r.id.code); description = (textview) itemview.findviewbyid(r.id.desscription); price = (textview) itemview.findviewbyid(r.id.price);  // locate imageview in listview_item.xml image = (imageview) itemview.findviewbyid(r.id.list_image);  // capture position , set results textviews brand.settext(resultp.get(mainactivity.brand)); category.settext(resultp.get(mainactivity.category)); code.settext(resultp.get(mainactivity.code)); description.settext(resultp.get(mainactivity.description)); price.settext(resultp.get(mainactivity.price)); // capture position , set results imageview // passes flag images url imageloader.class imageloader.displayimage(resultp.get(mainactivity.image), image); // capture listview item click  availability = (textview) itemview.findviewbyid(r.id.availability); if(availability.gettext().equals("available")){      availability.settextcolor(color.green);   }  return itemview;  }    } 


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -