Is it possible to return a value after Activity.runOnUiThread()
method.
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
int var = SOMETHING;
// how to return var value.
}
});
In this post i see that it's not possible to return a value after Runnable.run()
method. But how to use (implement) another interface and return a value after execution.
Hope it's clear for all.
EDIT
May help someone else.
I useD @Zapl's solution, and passED a parameter inside the Callable
class constructor, like this :
class MyCallable implements Callable<MyObject> {
int param;
public MyCallable (int param) {
// TODO Auto-generated constructor stub
this.param = param;
}
@Override
public MyObject call() throws Exception {
// TODO Auto-generated method stub
return methodReturningMyObject(this.param);
}
}