remy boys
remy boys

Reputation: 2958

take actions according to existence of value in column

am trying to check in a parse.com column or Key that a particular row haves an value (data) inside the column (named File) or not this is how i used to do that on swift for iOS

 guard let photo = object["File"] as? PFFile else { do soothing else }
    // here am firstly assigning a PFFile  name Photo  the value of an  parseObject's column ( if object haves file than assign else  ( do nothing) )

             photo.getDataInBackgroundWithBlock{
           (imageData:NSData?, error:NSError?)-> Void in
         // now am querying for data 

            if (error == nil){

                if object["File"] != nil {
                 cell.cellAttachment.alpha = 1
                 }}
            else if error != nil{
                print("error") //do nothing


            }
        }

    }
 //as you can see -  if parse object say (list) have value inside a key (File) than do something else do nothing

so my question is that how can i make a method for android using java , like this one for checking if a key contains value than add true in my array else add false in my array any guidance will be so helpful for me

Upvotes: 2

Views: 33

Answers (1)

user2097310
user2097310

Reputation:

 //get all images
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Images");
    query.whereWithinKilometers("location", parseGeoPoint, 100);
    query.orderByDescending("createdAt");

    query.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(List<ParseObject> objects, ParseException e) {
            if (objects.size() > 0) {
                if (e == null) {
                    if (!objects.isEmpty()) {
                        setupAdapter((ArrayList) (objects));
                    }
                } else if (e.getCode() == ParseException.REQUEST_LIMIT_EXCEEDED) {
                    makeSnack("Error! Reloading images.");
                    displayImages(); // How many times you do this is your business...
                } else {
                    e.printStackTrace();
                    Log.v("error", e.getMessage());
                }
            } else {
                //TODO:// if not images, reregister loclistener
                makeSnack("No images located near you.");
            }
        }
    });

Upvotes: 1

Related Questions