I am working on a simple app, actually my first attempt in Android.
Expected result
- I need the result to be shown in the English Language only, in case the mobile language is in Hindi for example.
- I want the number to be shown without the letter (E) when the number is long.
Code
protected void operation(char ope){
double num1 = Double.parseDouble(txtNum1.getText().toString());
double num2 = Double.parseDouble(txtNum2.getText().toString());
double resultMulti = 0;
switch (ope) {
case '*':
resultMulti = num1 * num2;
long a3=(long)resultMulti;
if (resultMulti-a3 <= 0)
txtMultiResult.setText(a3 + "");
else
txtMultiResult.setText(String.format("%.2f",resultMulti));// without E but will be converted to Mobile Language
// txtMultiResult.setText(resultMulti+""); // with E
// txtMultiResult.setText(String.valueOf(resultMulti));// With E
// txtMultiResult.setText(Double.toString(resultMulti));// with E
imm.hideSoftInputFromWindow(btnMulti.getWindowToken(),0);
break;
}
}