@Override
protected String doInBackground(String... params) {
Call<JsonObject> request = callObject.call();
JsonObject Value2;
JsonObject Value1;
try {
Response<JsonObject> response = request.execute();
JsonObject reader = response.body();
JsonObject Valute = reader.getAsJsonObject("Valute");
double a=1.0;
if (params[0]=="RUB") {
Value2 = Valute.getAsJsonObject(params[1]);
out = String.valueOf(Precision.round(a/Value2.get("Value").getAsDouble(),3));
return out;
}
else if (params[1]=="RUB"){
Value1 = Valute.getAsJsonObject(params[0]);
out = String.valueOf(Precision.round(Value1.get("Value").getAsDouble()/a,3));
return out;
}
else if (params[0]=="RUB" & params[1]=="RUB") { out = String.valueOf(1.0);
return out;
}
else {
Value1 = Valute.getAsJsonObject(params[0]);
Value2 = Valute.getAsJsonObject(params[1]);
out = String.valueOf(Precision.round(Value1.get("Value") //Использовал библиотеку
.getAsDouble()/Value2.get("Value").getAsDouble(),3));// APACH для округления чисел
return out;
}
} catch (IOException e) {
e.printStackTrace();
}
return out;
}
if ("RUB".equals(params[0])) {
if (params[0]=="RUB") {