在尝试检查parse.com columnKey特定行在列(名为File)中是否具有值(数据),这不是我以前在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


所以我的问题是我如何才能使用java为android创建一种方法,像这样检查键是否包含值,而不是在数组中添加true,否则在数组中添加false
任何指导都会对我有帮助

最佳答案

 //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.");
            }
        }
    });

10-05 20:26
查看更多