I have an Asynctask which retrieves two int vaules and i want to pass them to onPostExecute to show them on the view.
Here is my code:
public class Q
The most straightforward way is simply declare a small container object with the fields you want to return, then return an instance of that from doInBackground:
private class QueryResult {
int onlinePlayers;
int maxPlayers;
public QueryResult( int onlinePlayers, int maxPlayers ) {
this.onlinePlayers = onlinePlayers;
this.maxPlayers = maxPlayers;
}
}
protected QueryResult doInBackground(String... serverAddress) {
// ...
return new QueryResult( onlinePlayers, maxPlayers );
}