Value
- value type returned by asynchronous logic.public interface Callback<Value>
AsyncTask
and remote method invocation, like in sample code listed below. On first example handle(Object)
method is called transparently by asynchronous task after its execution completion.
AsyncTask<Object> task = new AsyncTask<Object>(callback) { protected Object handle() throws Throwable { // asynchronous task logic; } // here asynchronous task logic invoke Callback#handle with value returned by above AsyncTask#execute }; task.start();
WeatherService weatherService = Factory.getInstance("http://hub.bbnet.ro/", WeatherService.class); weatherService.getCurrentWeather(47.1569, 27.5903, new Callback<Weather>() { public handle(Weather weather) { // do something useful with returned weather value } });
Modifier and Type | Method and Description |
---|---|
void |
handle(Value value)
Hook to be executed after asynchronous logic execution ends.
|
void handle(Value value)
value
- value returned by asynchronous logic.Copyright © 2018. All rights reserved.