I am using the Decimal format class in the code I have below, but I can not get to change the language on my phone is always working (when I say it does not work I mean that does not set the numeric value in the textview that I need, but the problem is not that because as I say, in some languages if you set the normal text and the problem is not translation because if I do not use such formatting or rounding, the code works perfectly for all languages
Here part of my code where the problem is:
public void conversor(Double a, Double a1, Double a2,Double a3,Double a4,Double a5,Double a6,Double a7,Double a8,Double a9,Double a10,Double a11){
m.setText(" " + a+ " m");
cm.setText(" " + a1 + " cm");
km.setText(" " + a2 + " km");
dc.setText(" "+a3+" dm");
mm.setText(" "+a4+" mm");
mc.setText(" "+a5+" mc");
nm.setText(" "+a6+" nm");
pies.setText(" "+a7+ " ft");
pulgadas.setText(" "+a8+" inch");
millas.setText(" "+a9+" "+getResources (). getString(R.string.millas));
yardas.setText(" "+a10+" yd");
leguas.setText(" "+a11+" "+getResources (). getString(R.string.leguas));
}
textoizqu=(EditText)v.findViewById(R.id.textoizq);
try {
textoizqu.setOnEditorActionListener(new TextView.OnEditorActionListener()
{ @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
{ if(actionId== EditorInfo.IME_ACTION_DONE ||actionId==EditorInfo.IME_ACTION_NEXT)
{ try {a = Double.parseDouble(textoizqu.getText().toString());
DecimalFormat df = new DecimalFormat("#,#####");
conversor(Double.parseDouble(df.format(a)),Double.parseDouble(df.format(a*100)),Double.parseDouble(df.format(a/1000)), Double.parseDouble(df.format(a*10)),Double.parseDouble(df.format(a*1000)),Double.parseDouble(df.format(a*1000000)), Double.parseDouble(df.format(a*1000000000)),Double.parseDouble(df.format(a*3.28084)),Double.parseDouble(df.format(a*39.3701)), Double.parseDouble(df.format(a*0.000621371)),Double.parseDouble(df.format(a*1.09361)),Double.parseDouble(df.format(a* 0.00020712)));
}
catch (Exception e) {
a=0.0;
}
} return false; } });
a = Double.parseDouble(textoizqu.getText().toString());
conversor(Double.parseDouble(df.format(a)),Double.parseDouble(df.format(a*100)),Double.parseDouble(df.format(a/1000)),
Double.parseDouble(df.format(a*10)),Double.parseDouble(df.format(a*1000)),Double.parseDouble(df.format(a*1000000)),
Double.parseDouble(df.format(a*1000000000)),Double.parseDouble(df.format(a*3.28084)),Double.parseDouble(df.format(a*39.3701)),
Double.parseDouble(df.format(a*0.000621371)),
Double.parseDouble(df.format(a*1.09361)),Double.parseDouble(df.format(a* 0.00020712)));
} catch (Exception e) {
a=0.0;
}