I have made simple Android Calculator in Android Studio And Faced Some issue Explained in Body : MainActivity
       import android.support.v7.app.AppCompatActivity; import    android.os.Bundle; 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,b0,badd,bsub,bmul,bdiv,bdot,bans,bclear,b_bs; TextView  ans;    String a;    int lenght;    double var1,var2;    boolean add,sub,mul,div;    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       b1=(Button)findViewById(R.id.btn1);
       b2=(Button)findViewById(R.id.btn_2);
       b3=(Button)findViewById(R.id.btn_3);
       b4=(Button)findViewById(R.id.btn4);
       b5=(Button)findViewById(R.id.btn_5);
       b6=(Button)findViewById(R.id.btn_6);
       b7=(Button)findViewById(R.id.btn_7);
       b8=(Button)findViewById(R.id.btn_8);
       b9=(Button)findViewById(R.id.btn_9);
       b0=(Button)findViewById(R.id.btn_0);
       badd=(Button)findViewById(R.id.btn_Add);
       bsub=(Button)findViewById(R.id.btn_Sub);
       bmul=(Button)findViewById(R.id.btn_Multiply);
       bdiv=(Button)findViewById(R.id.btn_div);
       bdot=(Button)findViewById(R.id.btn_dot);
       bans=(Button)findViewById(R.id.btn_equal);
       bclear=(Button)findViewById(R.id.btn_Clear);
       ans=(TextView)findViewById(R.id.Answer);
       b_bs=(Button) findViewById(R.id.btn_bs);
   
   
   
       b1.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
              ans.setText("");
               ans.setText(ans.getText().toString()+"1");
   
           }
       });
   
       b2.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "2");
           }
       });
   
   
       b3.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "3");
           }
       });
   
   
       b4.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "4");
           }
       });
   
   
       b5.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "5");
           }
       });
   
   
       b6.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "6");
           }
       });
   
   
       b7.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "7");
           }
       });
   
   
       b8.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "8");
           }
       });
   
   
       b9.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "9");
           }
       });
   
   
       b0.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ "0");
           }
       });
   
   
       bdot.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText(ans.getText()+ ".");//this is the place where i need help }
       });
       b_bs.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
   
   
               String str=ans.getText().toString();
               if (str.length() >1 ) {
                   str = str.substring(0, str.length() - 1);
                   ans.setText(str);
               }
               else if (str.length() <=1 ) {
                   ans.setText("0");
               }
   
   
           }
       });
   
   
       badd.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               var1=Double.parseDouble(ans.getText()+"");
               add=true;
              ans.setText(null);
           }
       });
   
   
   
       bsub.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               var1=Double.parseDouble(ans.getText()+"");
               sub=true;
               ans.setText(null);
           }
       });
   
       bmul.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               var1=Double.parseDouble(ans.getText()+"");
               mul=true;
               ans.setText(null);
           }
       });
   
       bdiv.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               var1=Double.parseDouble(ans.getText()+"");
               div=true;
               ans.setText(null);
           }
       });
   
       bans.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
   
               var2=Double.parseDouble(ans.getText()+"");
               if(add==true){
   
                   ans.setText(var1+var2+"");
                   add=false;
   
               }
               if(sub==true){
   
                   ans.setText(var1-var2+"");
                   sub=false;
               }
               if(mul==true){
   
                   ans.setText(var1*var2+"");
                   mul=false;
               }
               if(div==true){
                   ans.setText(var1/var2+"");
                   div=false;
               }
   
   
           }
       });
       bclear.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               ans.setText("0");
            //  a=ans.length();
   
   
   
   
           }
       });
       } }
I have made simple Android Calculator Now I have Some Problems Kindly Solved these
 1. My dot Button Pressed More Than One Time durring First input number  and its show like 4....5...... i want that its not pressed or show more than 1 time in first time and after i select the operation of addition subtraction  not its will be enable for me ?
 2. I  want to set a default Value of Calculator  0 And When i press Any button zero will be override ....?
   
- List item