@Override
    protected FilterResults performFiltering(CharSequence constraint) {
      FilterResults filterResults = new FilterResults();
      if (constraint != null && constraint.length() > 0) {
        ArrayList<RowItem> tempList = new ArrayList<RowItem>();

        // search content in friend list
        for (RowItem user : commodityDetails) {
          if (user.getCommodityName().toLowerCase().contains(constraint.toString().toLowerCase())) {
            tempList.add(user);
          } else if (user.getVarietyName()
              .toLowerCase()
              .contains(constraint.toString().toLowerCase())) {
            tempList.add(user);
          } else if (user.getPrice().toLowerCase().contains(constraint.toString().toLowerCase())) {
            tempList.add(user);
          } else if (user.getDate().toLowerCase().contains(constraint.toString().toLowerCase())) {
            tempList.add(user);
          } else if (user.getDate().toLowerCase().contains(constraint.toString().toLowerCase())) {
            tempList.add(user);
          } else {
          }
        }

        filterResults.count = tempList.size();
        filterResults.values = tempList;
      } else {
        filterResults.count = commodityDetails.size();
        filterResults.values = commodityDetails;
      }

      return filterResults;
    }
  /** List view preparation */
  public View getView(int position, View convertView, ViewGroup parent) {

    final ViewHolder holder;
    final RowItem rowItem = (RowItem) getItem(position);

    convertView = null;
    if (convertView == null) {
      LayoutInflater mInflater =
          (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);

      convertView = mInflater.inflate(R.layout.commodity_details_row, parent, false);

      holder = new ViewHolder();
      holder.commodityName = (TextView) convertView.findViewById(R.id.commodityname);
      holder.varietyName = (TextView) convertView.findViewById(R.id.varietyname);
      holder.date = (TextView) convertView.findViewById(R.id.date);
      holder.price = (TextView) convertView.findViewById(R.id.price);
      holder.unit = (TextView) convertView.findViewById(R.id.unit);
      holder.id = (TextView) convertView.findViewById(R.id.id);
      holder.mainCategory = (TextView) convertView.findViewById(R.id.mainCategory);
      holder.unitTagVALue = (TextView) convertView.findViewById(R.id.unitTypeTagValue);
      holder.offer = (ImageView) convertView.findViewById(R.id.imageoffer);
      holder.priceHideOrShow = (ImageView) convertView.findViewById(R.id.imageHideShow);
      holder.commodityImage = (ImageView) convertView.findViewById(R.id.list_commodity_image);
      holder.discountPrice = (TextView) convertView.findViewById(R.id.discountPrice);
      holder.quantity = (TextView) convertView.findViewById(R.id.quantity);
      holder.discountInPercentage = (TextView) convertView.findViewById(R.id.discountInPercentage);

      typeface = Typeface.createFromAsset(context.getAssets(), "fonts/Sanchez-Regular_0.ttf");
      holder.commodityName.setTypeface(typeface);
      holder.varietyName.setTypeface(typeface);
      holder.date.setTypeface(typeface);
      holder.price.setTypeface(typeface);
      holder.unit.setTypeface(typeface);
      holder.id.setTypeface(typeface);
      holder.discountPrice.setTypeface(typeface);
      holder.quantity.setTypeface(typeface);
      holder.discountInPercentage.setTypeface(typeface);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    /*try
    {
    	if (Build.VERSION.SDK_INT >= 16) {

    		userId.setBackground(customBg);
    		password.setBackground(customBg);

    	} else {

    		userId.setBackgroundDrawable(customBg);
    		password.setBackgroundDrawable(customBg);
    	}
    }
    catch (Exception e) {

    	Toast.makeText(getActivity(), "Something wrong..", Toast.LENGTH_LONG).show();


    }*/
    if (rowItem.getStatusPrice() != null && rowItem.getStatusPrice().equalsIgnoreCase("Hide")) {
      /*	holder.priceHideOrShow.setBackground(context.getResources()
      .getDrawable(R.drawable.hide2));*/

      if (Build.VERSION.SDK_INT >= 16) {
        holder.priceHideOrShow.setBackground(context.getResources().getDrawable(R.drawable.hide2));
      } else {

        holder.priceHideOrShow.setBackgroundDrawable(
            context.getResources().getDrawable(R.drawable.hide2));
      }

    } else {
      /*holder.priceHideOrShow.setBackground(context.getResources()
      .getDrawable(R.drawable.show2));*/
      if (Build.VERSION.SDK_INT >= 16) {
        holder.priceHideOrShow.setBackground(context.getResources().getDrawable(R.drawable.show2));
      } else {

        holder.priceHideOrShow.setBackgroundDrawable(
            context.getResources().getDrawable(R.drawable.show2));
      }
    }

    holder.unitTagVALue.setText(rowItem.getUnitTag());
    holder.commodityName.setText(rowItem.getCommodityName());
    holder.varietyName.setText(rowItem.getVarietyName());
    holder.date.setText(rowItem.getDate());
    holder.mainCategory.setText(rowItem.getMainCategory());
    holder.price.setText(rupeeSymbol + rowItem.getPrice());
    holder.unit.setText(rowItem.getUnit());
    holder.id.setText(rowItem.getId());
    holder.discountPrice.setText(rupeeSymbol + rowItem.getDiscountPrice());
    holder.discountInPercentage.setText(rowItem.getDiscountInPercentage() + " %");

    if (!rowItem.getDiscountInPercentage().equalsIgnoreCase("No discount")) {

      holder.price.setPaintFlags(holder.price.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      holder.offer.setVisibility(View.VISIBLE);
      holder.discountInPercentage.setVisibility(View.VISIBLE);
      holder.price.setVisibility(View.VISIBLE);

    } else {
      holder.price.setPaintFlags(0);
      holder.offer.setVisibility(View.GONE);
      holder.price.setVisibility(View.GONE);
      holder.discountInPercentage.setVisibility(View.GONE);
    }

    holder.commodityImage.setTag(rowItem.getImageURL());
    BitmapManager.INSTANCE.loadBitmap(rowItem.getImageURL(), holder.commodityImage, 200, 200);

    holder.priceHideOrShow.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            try {

              if (rowItem.getStatusPrice().equalsIgnoreCase("Hide")) {

                listener.DoTaskCompleted(
                    rowItem.getId().toString(), CommodityDetailsActivity.VENDOR_ID, "Show");
              } else {

                listener.DoTaskCompleted(
                    rowItem.getId().toString(), CommodityDetailsActivity.VENDOR_ID, "Hide");
              }

            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    holder.commodityImage.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {

            if (holder.commodityImage != null) {
              BitmapDrawable drawable = (BitmapDrawable) holder.commodityImage.getDrawable();
              Bitmap bitmap = drawable.getBitmap();

              maximizeImage(bitmap);
            }
          }
        });

    return convertView;
  }