title: Inflater not working for me when using base adapter in android
body: <p>I'm trying to inflate a layout but it is not working for me.
  I'm using a Basedapater in a listview.</p>
  
  <pre><code>int can1 = Integer.parseInt(c.getString(c.getColumnIndex("InCan")));
  if (can1 &lt; 1) {
      // ...
  } else {
      View view;
      LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = inflater.inflate(R.layout.receipt, null);
      TextView textView = (TextView) view.findViewById(R.id.rcan);
      textView.setVisibility(View.GONE);
      TextView coke3 = (TextView) view.findViewById(R.id.rcoke);
      coke3.setVisibility(View.GONE);
  
  can[i] = " Coke In Can: "+c.getString(c.getColumnIndex("InCan"));
  }
  </code></pre>
  
  <p>Could you point me out what the problem is?</p>
  
  <p>Here is my Adapter class that I used in my list view.
  Hope that you help me.</p>
  
  <pre><code>public class receiptadapter extends BaseAdapter {
  private Context context;
  private final String[] productname;
  private final String[] fixins;
  private final String[] original;
  private final String[] hot;
  private final String[] quantity;
  private final String[] price;
  private final String[] total;
  private final String[] salad;
  private final String[] coleslaw;
  private final String[] potato;
  private final String[] coke;
  private final String[] ccoke;
  private final String[] water;
  private final String[] can;
  
  public receiptadapter(Context context, String[] productname, String[] fixins,
          String[] original, String[] hot, String[] quantity,String[] price, 
          String[] total, String[] salad, String[] coleslaw, String[] potato, 
          String[] coke, String[] ccoke, String[] water, String[] can){
  
      this.context= context;
      this.productname = productname;
      this.fixins = fixins;
      this.original = original;
      this.hot = hot;
      this.quantity = quantity;
      this.price = price;
      this.total = total;
      this.salad = salad;
      this.coleslaw = coleslaw;
      this.potato = potato;
      this.coke = coke;
      this.ccoke = ccoke;
      this.water = water;
      this.can = can;
  }   
  public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
  
      LayoutInflater inflater = (LayoutInflater) context
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      viewHolder holder = new viewHolder();
  
      if(convertView == null ){
          convertView = inflater.inflate(R.layout.receipt, null);
  
          holder.pname = (TextView) convertView.findViewById(R.id.rpname);
          holder.fix = (TextView) convertView.findViewById(R.id.rfixins);
          holder.orig = (TextView) convertView.findViewById(R.id.rorig);
          holder.hot1 = (TextView) convertView.findViewById(R.id.rhot);
          holder.qty = (TextView) convertView.findViewById(R.id.rquantity);
          holder.price1 = (TextView) convertView.findViewById(R.id.rprice);
          holder.sub = (TextView) convertView.findViewById(R.id.rsub);
          holder.sal = (TextView) convertView.findViewById(R.id.rsal);
          holder.col = (TextView) convertView.findViewById(R.id.rcol);
          holder.pot = (TextView) convertView.findViewById(R.id.rpot);
          holder.coke1 = (TextView) convertView.findViewById(R.id.rcoke);
          holder.coke2 = (TextView) convertView.findViewById(R.id.rccoke);
          holder.water1 = (TextView) convertView.findViewById(R.id.rwater);
          holder.can1 = (TextView) convertView.findViewById(R.id.rcan);
          convertView.setTag(holder);
  
  
      }else{
          holder = (viewHolder) convertView.getTag();
      }
  
      holder.pname.setText(productname[position]);
      holder.fix.setText(fixins[position]);
      holder.orig.setText(original[position]);
      holder.hot1.setText(hot[position]);
      holder.qty.setText("  Quantity: "+quantity[position]);
      holder.price1.setText("  Price: PHP "+price[position]);
      holder.sub.setText("  Sub - Total: PHP "+total[position]);
      holder.sal.setText(salad[position]);
      holder.col.setText(coleslaw[position]);
      holder.pot.setText(potato[position]);
      holder.coke1.setText(coke[position]);
      holder.coke2.setText(ccoke[position]);
      holder.water1.setText(water[position]);
      holder.can1.setText(can[position]);
  
      return convertView;
  }
  
  public int getCount() {
      // TODO Auto-generated method stub
      return productname.length;
  }
  
  public Object getItem(int arg0) {
      // TODO Auto-generated method stub
      return null;
  }
  
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return 0;
  }
  
  class viewHolder{
      TextView pname;
      TextView fix;
      TextView orig;
      TextView hot1;
      TextView price1;
      TextView qty;
      TextView sub;
      TextView sal;
      TextView col;
      TextView pot;
      TextView coke1;
      TextView coke2;
      TextView water1;
      TextView can1;
  }
  </code></pre>
  
  <p>}</p>