java.lang.Objectcom.netmera.mobile.NetmeraCallback<T>
T
- - Type of the NetmeraCallback object.public abstract class NetmeraCallback<T>
NetmeraCallback is used to run code with response data coming from Netmera after the background thread finishes running.
The code that do the main job runs on the background thread, however the
callback(Object, NetmeraException)
, onSuccess(Object)
and onFail(NetmeraException)
methods run on the main thread.
This ensures that main thread will not freeze while doing operations on data.
Constructor Summary | |
---|---|
NetmeraCallback()
|
Method Summary | |
---|---|
void |
callback(T result,
NetmeraException exception)
Deprecated. instead this, use onSuccess(Object) and onFail(NetmeraException) .
After the code finishes running override this method to get the results. |
abstract void |
onFail(NetmeraException exception)
After the code finishes running override this method to distinguish failures easily. |
abstract void |
onSuccess(T result)
After the code finishes running override this method to get the results. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NetmeraCallback()
Method Detail |
---|
@Deprecated public void callback(T result, NetmeraException exception)
onSuccess(Object)
and onFail(NetmeraException)
.
After the code finishes running override this method to get the results.
result
- - Object that returns after running the code.exception
- - Throws exception if it cannot access server.public abstract void onSuccess(T result)
result
- - Object that returns after running the code.public abstract void onFail(NetmeraException exception)
exception
- - Callback falls into this method if it cannot access server/server does not permit current operation.