Skip to content
Arasthel edited this page Aug 21, 2014 · 3 revisions

This annotation will execute the code inside the method on a background Thread.

##Important

Methods annotated with this can have a return type, such as boolean, String, etc., but you can only use its result when the calling code is also on a background Thread. Otherwise it won't return anything as it will be executed inside a Thread.

Example

@OnBackground()
public boolean getResult(){...}

// If myVariable declaration is done on a background Thread
boolean myVariable = getResult();