NumberFormat numberFormat = NumberFormat.getCurrencyInstance(new Locale("en","IN"));
if (type1!=null && type2!=null){
if( rates.containsKey(type1) && rates.containsKey(type2)) {
Double rate1 = rates.getOrDefault(type1,1.00);
Double rate2 = rates.getOrDefault(type2,1.00);
double inp1 = Double.parseDouble(edt1.getText().toString());
result = (rate2 / rate1) * inp1;
numberFormat.setCurrency(Currency.getInstance(type2));
edt2.setText(numberFormat.format(result));
}
}else {
Toast.makeText(this, "No Input", Toast.LENGTH_SHORT).show();
}
Comments
Post a Comment