How to pass two parse function in doinbackground function?
Answers
Answered by
0
on the view.
Here is my code:
public class QueryServer extends AsyncTask <String, Void, Integer> {
protected Integer doInBackground(String... serverAddress) {
Log.d("QueryServer", ""+serverAddress[0]);
MCQuery mcQuery = new MCQuery("" + serverAddress[0] ,25565);
QueryResponse response = mcQuery.basicStat();
int Onlineplayers = response.getOnlinePlayers(); //first vaule
int Maxplayers = response.getMaxPlayers(); //second vaule
Log.d("MCQuery", "" + Onlineplayers + " OnlinePlayers");
return Onlineplayers;
}
protected void onPostExecute(Integer Onlineplayers){
TextView onlinePlayersView = (TextView) findViewById(R.id.online_players);
onlinePlayersView.setText(""+Onlineplayers+"/"+ Maxplayers); //i need to pass Maxplayers to use it here
}
Here is my code:
public class QueryServer extends AsyncTask <String, Void, Integer> {
protected Integer doInBackground(String... serverAddress) {
Log.d("QueryServer", ""+serverAddress[0]);
MCQuery mcQuery = new MCQuery("" + serverAddress[0] ,25565);
QueryResponse response = mcQuery.basicStat();
int Onlineplayers = response.getOnlinePlayers(); //first vaule
int Maxplayers = response.getMaxPlayers(); //second vaule
Log.d("MCQuery", "" + Onlineplayers + " OnlinePlayers");
return Onlineplayers;
}
protected void onPostExecute(Integer Onlineplayers){
TextView onlinePlayersView = (TextView) findViewById(R.id.online_players);
onlinePlayersView.setText(""+Onlineplayers+"/"+ Maxplayers); //i need to pass Maxplayers to use it here
}
abhi1656:
What u understanding me
Similar questions