Hello I have such a code: pointsToAssignTv.setText(String.valueOf(restData.getPointsUnass(login))); where restData.getPointsUnass(login) is such a Retrofit code:
public int getPointsUnass(String name) {
Call<String> result = Api.getClient().getPointsUnass(name);
result.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
pointsUnass = Integer.parseInt(response.body());
}
@Override
public void onFailure(Call<String> call, Throwable t) {
Log.e("tag",t.toString());
}
});
return pointsUnass;
}
I want to assign this value to this TextView but it returns null, I guess it is all about time it needs to process through the internet and then return. What piece of code would you recommend to write instead?