Array Index Out of Bounce exception while getting online users using appwarp

0 votes

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.
 
closed with the note: Closing this thread as there was no update from last 2 Weeks or more. Please raise a new query if problem persists.
asked Jul 22, 2014 in App42 Cloud API-BaaS by rkrishna (22 points)
closed Sep 17, 2014 by sushil
Can you copy/paste your code that you are using in onGetOnlineUsersDone?
I have edited my Question with code.Please have a look.I am getting null  though more than 3 users are in online before  i call getonlineUsers method
What are you getting in getResult() of AllUsersEvent?
i am getting  result 5 which means connection error.So tried again to recovery connection if result is 5.But it is not connecting to server.Please help me.
Since you are getting result 5 in onGetOnlineUsersDone, this means you were not connected to appwarp server when you were calling getOnlineUsers().

You should call getOnlineUsers() and other APIs only if you have gotten success result code in onConnectDone.

If you have successfully connected and then later occurs a connection issue, you will get a connection error in onConnectDone, there you can call the recover connection(if recovery allowance was set).
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...