Skip to content Skip to sidebar Skip to footer

Retrieve Data From A Class In Parse.com

I have a class in Parse.com, as XYZ, and it has columns email, password, phone, age. I have email and password combination and I want to check whether there is such a combination i

Solution 1:

ParseQuery return ParseException just if there was technical issue calling the server. else, even though your query doesn't find exactly what you looked for, it will return an empty list and the 'e' var will be null. so what you need to do is :

    ParseQuery<ParseObject> query = ParseQuery.getQuery("donate");
    query.whereEqualTo("email", e);
    query.whereEqualTo("password", pw);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, ParseException e) {
            if (e == null) {
                if (list.isEmpty() == false) {   // add this
                    Toast.makeText(getApplicationContext(), "Success!!!", Toast.LENGTH_LONG).show(); 
                }else{
                    Toast.makeText(getApplicationContext(), "Worng password!!!", Toast.LENGTH_LONG).show(); // add this

                }

            } else {
                Toast.makeText(getApplicationContext(), "Something went wrong!!!", Toast.LENGTH_LONG).show();
            }
        }
    });

Post a Comment for "Retrieve Data From A Class In Parse.com"