I have a Gridview and Custom adapter.
in my adapter, i have a static ViewHolder instance.
static class ViewHolder
{
TextView _model,tPrice,pPrice;
ImageView picture;
}
This is my ViewHolder. When the user clicked a button in the fragment, I just want to make tPrice visibility GONE. When i create a istance of the adapter i send an integer parameter for tPrice VISIBLITY. But its data still on the static data. I wanna change the this area. i need an instance of my current view. i will cast it to my ViewHolder. After do this i set the visiblity. But How can I do it?
Here are the getView and my constructer
private int TFV = View.GONE;
private int PFV= View.GONE;
public ProductGridViewAdapter(Context p_context, int p_resourceId,ArrayList<Product> p_ProductList,int TFVisib,int PFVisib){
super(p_context,p_resourceId,p_ProductList);
originalItems = p_ProductList;
TFV = TFVisib;
PFV = PFVisib;
_ctx = p_context;
//....
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
View row = convertView;
if(row==null){
holder = new ViewHolder();
row = li.inflate(_resourceId, null);
holder._model = (TextView) row.findViewById(R.id.o_model);
holder.pPrice = (TextView) row.findViewById(R.id.product_pf);
holder.tPrice = (TextView) row.findViewById(R.id.product_tf);
holder.picture = (ImageView)row.findViewById(R.id.product_lv_image);
row.setTag(holder);
}else{
holder = (ViewHolder) row.getTag();
}
Product f =null;
if(originalItems!=null)
f = originalItems.get(position);
if (f != null) {
holder._model.setText(f.GetCODE());
holder.pPrice.setText(f.GetPRICE());
holder.pPrice.setVisibility(PFV);
holder.tPrice.setVisibility(TFV);
holder.tPrice.setText(f.GetCURRENCY());
File imgFile = new File(uhandler.GetProductsFolderPath()+"/BIG"+f.GetCODE()+".jpg");
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
holder.picture.setImageBitmap(myBitmap);
}
}
return row;
}
i solved my problem. I had set the adapter again. This way may be a bad way but its work :)