Hello Community,
I am working on turn based game.I am getting online users from appwarp.But i am facing following issue when i get Online users.
Exception:
AppWarpTrace Exception class java.lang.ArrayIndexOutOfBoundsException in thread run length=4096; regionStart=0; regionLength=-1.
Issue :I am having a Online Play button.On clicking that i am showing all online users in a list to send notifications.If the users are zero , I am showing a popup that there are no users.But when i check the length of array to get total online users i am getting this exception.
Please help me out to resolve this issue.
Following is the code placed in onGetOnlineUsersDone method:
if(resultActivity instanceof GameActivity){
final String[] onlineUsersList = event.getUserNames(); // getting Exception in this line
final GameActivity menuActivity = (GameActivity)resultActivity;
if(onlineUsersList.length > 1){
menuActivity.moveToPlayersList();
}else{
menuActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Utils.AlertShowDialog("Sorry!There are no online users.Try Later", menuActivity);
}
});
}
}
Thanks.