Well,I have a counter value got it from another activity.Now in current activity,with a help of a button,I want to add that counter value on the toolbar(just like any cart:where one item added scenario).Below my receiving intent:

```
public class ShoppingCart extends AppCompatActivity {
private Button btn4_s_add,btn5_s_rem,btn6_s_add_to_cart;
private int c_number;
private TextView tv5;
public int counter_s=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.shopingcart);

    tv5=(TextView)findViewById(R.id.textView5);
    btn4_s_add=(Button) findViewById(R.id.button4);
    btn5_s_rem=(Button) findViewById(R.id.button5);
    btn6_s_add_to_cart=(Button)findViewById(R.id.button6);

    c_number=getIntent().getIntExtra("counter",0);
    tv5.setText(Integer.toString(c_number));

    btn4_s_add.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            counter_s=c_number;
            counter_s++;

        }
    });
    btn5_s_rem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            counter_s=c_number;
            counter_s--;

        }
    });

    btn6_s_add_to_cart.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            counter_s=c_number;
            if(counter_s==0){
                Toast.makeText(ShoppingCart.this, "Your cart is empty", Toast.LENGTH_SHORT).show();
            }
            else{

```

//Now here I want to add the value of counter on the toolbar.Obviously,how do I add badge or other.This is like a checkout button,once you hit,you counter gets visible in toolbar.

```
            }
        }
    });

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main,menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    return super.onOptionsItemSelected(item);
}

```

`}`