title: android Clear Button in a simple counter
body: <p>I have a counter program for number. I define 3 buttons for Plus, Minus and Clear.
  When I use clear button for clear TextView it's good. But after using Plus and Minus it it is Continuation last counter. that is my code.
  please Help me.</p>
  
  <pre><code>public class CounterActivity extends Activity {
  
  private Button   btnPlus;
  private Button   btnMinus;
  private Button   btnClear;
  private TextView txtCounter;
  
  int              counter = 0;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.counter_menu);
  
      btnPlus = (Button) findViewById(R.id.btnPlus);
      btnMinus = (Button) findViewById(R.id.btnMinus);
      btnClear = (Button) findViewById(R.id.btnClear);
      txtCounter = (TextView) findViewById(R.id.txtCounter);
  
      btnPlus.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
              counter++;
              txtCounter.setText(counter + "");
          }
      });
  
      btnMinus.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
              counter--;
              txtCounter.setText(counter + "");
          }
      });
  
      btnClear.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              txtCounter.setText(0 + "");
          }
      });
  }
  }
  </code></pre>