title: Touch Calculator is not working properly
body: <p>I am making a touch calculator. Whenever I run app, at the first time it works fine but after using 1 time when I try to press any number like 1,2,3,etc. It only presses one time. That is I can't write more than 1 figure number. Here's my code.</p>
  
  <pre><code>package bt4u.com.calculator;
  
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class MainActivity extends AppCompatActivity {
  
  Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20;
  float result;
  float a;
  float b;
  float c;
  Boolean get=false,error=false;
  
  int d,count=0,q;
  TextView tv,tv2;
  String str;
  
  
  int action;//0-add,1-sub,2-mul,3-div
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      b1=(Button)findViewById(R.id.button1);
      b2=(Button)findViewById(R.id.button2);
      b3=(Button)findViewById(R.id.button3);
      b4=(Button)findViewById(R.id.button4);
      b5=(Button)findViewById(R.id.button5);
      b6=(Button)findViewById(R.id.button6);
      b7=(Button)findViewById(R.id.button7);
      b8=(Button)findViewById(R.id.button8);
      b9=(Button)findViewById(R.id.button9);
      b10=(Button)findViewById(R.id.button10);
      b11=(Button)findViewById(R.id.button11);
      b12=(Button)findViewById(R.id.button12);
      b13=(Button)findViewById(R.id.button13);
      b14=(Button)findViewById(R.id.button14);
      b15=(Button)findViewById(R.id.button15);
      b16=(Button)findViewById(R.id.button16);
      b17=(Button)findViewById(R.id.button17);
      b18=(Button)findViewById(R.id.button18);
      b19=(Button)findViewById(R.id.button19);
      b20=(Button)findViewById(R.id.button20);
      tv=(TextView)findViewById(R.id.textView2);
      tv2=(TextView)findViewById(R.id.textView);
  
      View.OnClickListener click = new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              switch (v.getId()){
                  case R.id.button1:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"9");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button2:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"8");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button3:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"7");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button4:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"6");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button5:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"5");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button6:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"4");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button7:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"3");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button8:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"2");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button9:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"1");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button10:
                      str=tv.getText().toString();
                      if (str.length()!=0) {
                          if (str.contains("."))
                              q=0;
                          else
                          tv.setText(tv.getText() + ".");
                          get=false;
                      }
  
                      break;
                  case R.id.button11:
                      if (get)
                          tv.setText(null);
                      tv.setText(tv.getText()+"0");
                      b=Float.parseFloat(tv.getText().toString());
                      break;
                  case R.id.button12:
                      switch (action){
                          case 0:
                              result=a+b;
                              break;
                          case 1:
                              result=a-b;
                              break;
                          case 2:
                              result=a*b;
                              break;
                          case 3:
                              result=a/b;
                              break;
                      }
                      if (result==Math.ceil(result)) {
                          d = (int) result;
                          tv.setText("" + d);
  
                      }
                      else {
                          tv.setText("" + result);
                      }
                      tv2.setText(null);
                      get=true;
                      break;
  
                  case R.id.button13:
                     try {
                         a = Float.parseFloat(tv.getText().toString());
                     }
                     catch (NumberFormatException e){
                         error=true;
                     }
                      if (!error) {
                          tv2.setText(tv.getText() + "+");
                          action = 0;
                      }
                      error = false;
                      tv.setText(null);
                      break;
  
                  case R.id.button14:
                      try {
                          a = Float.parseFloat(tv.getText().toString());
                      }
                      catch (NumberFormatException e){
                          error=true;
                      }
                      if (!error) {
                          tv2.setText(tv.getText() + "*");
                          action = 2;
                      }
                      error = false;
                      tv.setText(null);
                      break;
  
                  case R.id.button15:
                      try {
                          a = Float.parseFloat(tv.getText().toString());
                      }
                      catch (NumberFormatException e){
                          error=true;
                      }
                      if (!error) {
                          tv2.setText(tv.getText() + "-");
                          action = 1;
                      }
                      error = false;
                      tv.setText(null);
                      break;
  
                  case R.id.button16:
                      try {
                          a = Float.parseFloat(tv.getText().toString());
                      }
                      catch (NumberFormatException e){
                          error=true;
                      }
                      if (!error) {
                          tv2.setText(tv.getText() + "/");
                          action = 3;
                      }
                      error = false;
                      tv.setText(null);
                      break;
  
              }
          }
      };
      b1.setOnClickListener(click);   b14.setOnClickListener(click);
      b2.setOnClickListener(click);   b15.setOnClickListener(click);
      b3.setOnClickListener(click);   b16.setOnClickListener(click);
      b4.setOnClickListener(click);   b17.setOnClickListener(click);
      b5.setOnClickListener(click);   b18.setOnClickListener(click);
      b6.setOnClickListener(click);   b19.setOnClickListener(click);
      b7.setOnClickListener(click);   b20.setOnClickListener(click);
      b8.setOnClickListener(click);   b13.setOnClickListener(click);
      b9.setOnClickListener(click);   b12.setOnClickListener(click);
      b10.setOnClickListener(click);  b11.setOnClickListener(click);
  }
  
  }
  </code></pre>