PlayerIO

The fastest way to build online games without breaking a sweat.

Android Client Reference

Android  class documentationClass Callback<T>

Namespace: com.playerio
Language: Java

A generic callback adapter for methods returning regular errors.

When using any asynchronous method in this API, you should supply a callback object if you want to handle the results of the call, or handle any errors that happened.

The easiest way to implement a callback is to use an anonymous inner class, like this:

You don't have to override the methods if you don't care about either the result or the error, and if you don't care about any of them, you can just send in a null callback:

Methods

 
public abstractvoid
onError (PlayerIOError error)

If an error occurred for your method call, this method will be called with the error. You should override this method if you want to perform any action when an error happens, for example alerting the user or logging the error, etc.

public abstractvoid
onSuccess (T result)

If the method call is a success, this method will be called with whatever the results were for that call. You should override this method if you want to handle the success case.

Callback<T>.onError

public abstractvoid
onError (PlayerIOError error)

If an error occurred for your method call, this method will be called with the error. You should override this method if you want to perform any action when an error happens, for example alerting the user or logging the error, etc.

Arguments

PlayerIOError error

Callback<T>.onSuccess

public abstractvoid
onSuccess (T result)

If the method call is a success, this method will be called with whatever the results were for that call. You should override this method if you want to handle the success case.

Arguments

T result