title: Access toolbar item from adapter class
body: <p>i am working one shopping cart app. i have activity with cutom toolbar(Actionbar) with textview and imageview. and in activity i have simple listview which display product list. and have adapter class for listview of activity.
  here i want that from adapter class onclick event of add(+) button i want to change textview value as total number of product count which is in my toolbar.</p>
  
  <p>[i want something like this]</p>
  
  <p><a href="https://drive.google.com/open?id=0B9qgugNyvGRiUzF3c0hieFpLVTQ" rel="nofollow noreferrer">https://drive.google.com/file/d/0B9qgugNyvGRiV2ZrVlp3TUlIM3M/view</a></p>
  
  <p>i can achive it in activity but dnt know how to get this functionality from adapter class.
  <a href="https://drive.google.com/open?id=0B9qgugNyvGRiUzF3c0hieFpLVTQ" rel="nofollow noreferrer">https://drive.google.com/open?id=0B9qgugNyvGRiUzF3c0hieFpLVTQ</a></p>
  
  <p>here is my code</p>
  
  <p>adapter code</p>
  
  <pre><code>public class Product_List_Adapter extends BaseAdapter {
  Context acontext;
  String[] aproductname;
  String[] aproduct_unit;
  String[] aproduct_discount;
  String[] aproduct_previous_price;
  String[] aproduct_latest_price;
  int[] aproduct_img;
  int totalunit=0;
  int[] acoupencode;
  String product_count;
  private static LayoutInflater inflater=null;
  public Product_List_Adapter(Context context,String[]productname,String[]product_unit,String[]product_discount,String[]product_previous_price,String[]product_latest_price,int[]product_img,int[] coupencode)
  {
      acontext=context;
      aproductname=productname;
      aproduct_unit=product_unit;
      aproduct_discount=product_discount;
      aproduct_previous_price=product_previous_price;
      aproduct_latest_price=product_latest_price;
      aproduct_img=product_img;
      acoupencode=coupencode;
      inflater = ( LayoutInflater )context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }
  
  @Override
  public int getCount() {
      return aproductname.length;
  }
  
  @Override
  public Object getItem(int position) {
      return position;
  }
  
  @Override
  public long getItemId(int position) {
      return position;
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    final  Holder  holder=new Holder();
      View rowView;
      rowView = inflater.inflate(R.layout.productlist_listview_single_row, null);
  
      View toolbaritme;
      toolbaritme = inflater.inflate(R.layout.productlist_listview_single_row, null);
  
  
      holder.productname =(TextView) rowView.findViewById(R.id.productlist_singlerow_product_title);
      holder.product_unit =(TextView) rowView.findViewById(R.id.productlist_singlerow_product_unit);
      holder.product_discount =(TextView) rowView.findViewById(R.id.productlist_singlerow_product_discount);
      holder.product_previous_price =(TextView) rowView.findViewById(R.id.productlist_singlerow_previous_price);
      holder.product_latest_price =(TextView) rowView.findViewById(R.id.productlist_singlerow_latest_price);
      holder.product_count=(TextView)rowView.findViewById(R.id.product_count);
      holder.product_img=(ImageView) rowView.findViewById(R.id.productlist_singlerow_imgevew);
      holder.btn_add=(ImageView)rowView.findViewById(R.id.product_list_singlerow_btn_add);
      holder.btn_remove=(ImageView)rowView.findViewById(R.id.product_list_singlerow_btn_remove);
  
      holder.itemcount=(TextView)toolbaritme.findViewById(R.id.itemcount_actionbar);
  
      holder.layout_product_discount =(LinearLayout)rowView.findViewById(R.id.layout_product_discount);
  
      holder.productname.setText(aproductname[position]);
      holder.product_unit.setText(aproduct_unit[position]);
      holder.product_discount.setText(aproduct_discount[position]);
      holder.product_previous_price.setText(aproduct_previous_price[position]);
      holder.product_latest_price.setText(aproduct_latest_price[position]);
      holder.product_img.setImageResource(aproduct_img[position]);
      holder.product_previous_price.setPaintFlags(holder.product_previous_price.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
  
      holder.btn_add.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              totalunit +=1;
              product_count=Integer.toString(totalunit);
              holder.product_count.setText(product_count);
              holder.itemcount.setText(product_count);
  
              if(holder.product_count.equals("0"))
              {
                  holder.product_count.setText("");
              }
          }
      });
      holder.btn_remove.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v)
          {
                      if(totalunit==0)
                      {
                          Toast.makeText(acontext, "no item in cart ", Toast.LENGTH_SHORT).show();
                          holder.product_count.setText("");
                      }
                      else
                      {
                          totalunit -=1;
                          product_count=Integer.toString(totalunit);
                          holder.product_count.setText(product_count);
                      }
  
              if(holder.product_count.equals("0"))
              {
                  holder.product_count.setText("");
              }
          }
      });
  
      rowView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Toast.makeText(acontext, "You Clicked "+aproductname[position], Toast.LENGTH_LONG).show();
          }
      });
  
  
  
      if(acoupencode[position]==0)
      {
         holder.layout_product_discount.setVisibility(View.GONE);
      }
      else
      {
          holder.layout_product_discount.setVisibility(View.VISIBLE);
      }
  
  
  
      holder.product_img.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent myint =new Intent(acontext.getApplicationContext(), Product_view.class);
              acontext.startActivity(myint);
          }
      });
  
      return rowView;
  }
  
  public class Holder
  {
      TextView productname,product_unit,product_discount,product_previous_price,product_latest_price,product_count,itemcount;
      ImageView product_img,btn_add,btn_remove;
      LinearLayout layout_product_discount;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Help will appreciated,</p>
  
  <p>Thanks in advance</p>