Ram's stack
Ram's stack

Reputation: 307

How do I check if the value is defined for a key of an object in Parse Android?

Say I have an Object Parent containing Name as one of the keys. I gotta do a task only after checking if the value say Tom is available under the key Name. This is kind of checking for username and password but Parse handles it with inbuilt code.

How do I check for the availability of value for a key in an object in Parse Android?

Any help is appreciated!

Upvotes: 0

Views: 53

Answers (1)

hatboy
hatboy

Reputation: 66

Try this buddy..

private void checkingKey(){
   ParseQuery<ParseObject> lookUp = ParseQuery.getQuery("Parent");
   lookUp.whereEqualTo("Name",key);
   lookUp.findInBackground(new FindCallback<ParseObject>() {
       @Override
       public void done(List<ParseObject> list, ParseException e) {
           if(e==null && list.size()!=0){
               //KEY FOUND //
               Toast.makeText(getApplicationContext(),list.get(0).get("Name").toString(),Toast.LENGTH_LONG).show();
           }else{
               //Error fetching Key
           }
       }
   });

}

Upvotes: 1

Related Questions