This is my code.
ArrayList<String> usr = new ArrayList<>();
mypubnub.hereNow()
.channels(Collections.singletonList(channel_name))
.includeUUIDs(true)
.async(new PNCallback<PNHereNowResult>() {
@Override
public void onResponse(PNHereNowResult result, PNStatus status) {
try {
JSONObject object = new JSONObject(result.getChannels());
JSONArray jsonArray = object.getJSONArray("uuids");
for (int i = 0; i < jsonArray.length(); i++) {
usr.add(jsonArray.getString(i));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
How can i create the list with online users name from PNHereNowResult result?
new JSONObject(result.getChannels()) does't work.
It says that can't be converted to an object.