Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse.com getting all usernames

I 've tried and googled alot to get all usernames from parse.com. the following code works for other tables but when I try this on the Parse.Users table it doesn't work.

ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("User");
try {
    List<ParseObject> usersList = query.find();
    data = new String[usersList.size()+1];

    for (int i = 0; i < usersList.size(); i++) {
        data[i] = usersList.get(i).getString("username");
    }

plz tell me the right way to fetch all users

like image 313
Tanweer Avatar asked Dec 26 '22 06:12

Tanweer


1 Answers

There's a special query to users class.

ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("gender", "female");
query.findInBackground(new FindCallback<ParseUser>() {
  public void done(List<ParseUser> objects, ParseException e) {
    if (e == null) {
        // The query was successful.
    } else {
        // Something went wrong.
    }
  }
});

You can find more information on the android guide at parse documentation.

like image 75
Jorge Avatar answered Jan 08 '23 12:01

Jorge