I'd like to get color value inside void run, how can I do this? any example? color is null there.
public void onResponse(Call call, final Response response) throws IOException {
String color = response.body().string();
Profile.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setTheme(color); //color is null here.
}
}
}
color is null inside run() full code:
protected void onCreate(Bundle savedInstanceState) {
this.context = getApplicationContext();
OkHttpClient client = new OkHttpClient();
okhttp3.Request request = new okhttp3.Request.Builder()
.url("http://ip/color.php")
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, final Response response) throws IOException {
String color = response.body().string();
Profile.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setTheme(color);
}
}
}
});...