java - Dot function for android calculator -


i not able figure out way find method implement possibilities put dot decimal representation of numbers

the calculator has 1 text field (edittext) computes values there 2 operators first part solved , appends operator

some thing tried...

    public void dot(view v) {     if(count==1)     {         edittext et=(edittext) findviewbyid(r.id.edittext1);         string input=et.gettext().tostring();         string[] parts=input.split("[+ - * /]");         if(parts[4].matches("[.]")){             return;         }         else{             et.append(".");         }     }     else{         edittext et=(edittext) findviewbyid(r.id.edittext1);         string input=et.gettext().tostring();         if(input.matches("[.]"))             return;         else{             if(input.length()==0)                 et.append("0");             et.append(".");         }     }  } 

count keeps track of number of operators {values(0,1)}


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -