I'm just starting to play around with android app. I have an text field to input numbers but somehow I can only type in regular integers without decimals.
any idea what I can do so I can input decimals too?
This is what I have..
public void onClick(View arg0) {
EditText edit = (EditText)findViewById(R.id.editText1);
TextView text = (TextView)findViewById(R.id.textView1);
String input = edit.getText().toString();
float num = 0;
try {
num = Integer.parseInt(input);
} catch (NumberFormatException e) {
input = "0";
}
double newNum = num * 1.12;
DecimalFormat df = new DecimalFormat("###.##");
text.setText(input + " * 12% = " + df.format(newNum));