Android 根据列中存在的值采取行动
我试图在parse.comAndroid 根据列中存在的值采取行动,android,parse-platform,Android,Parse Platform,我试图在parse.com列或键中检查特定行是否在列(名为文件)内有值(数据)这是我在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 th
列
或键
中检查特定行是否在列(名为文件
)内有值(数据)这是我在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
所以我的问题是,我如何使用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.");
}
}
});
ParseQuery=ParseQuery.getQuery(“图像”);
查询。其中里程计(“位置”,parseGeoPoint,100);
query.orderByDescending(“createdAt”);
findInBackground(新的FindCallback(){
@凌驾
公共void done(列出对象,parsee异常){
如果(objects.size()>0){
如果(e==null){
如果(!objects.isEmpty()){
setupAdapter((ArrayList)(objects));
}
}否则如果(e.getCode()==ParseException.REQUEST\u LIMIT\u超出){
makeSnack(“错误!正在重新加载图像”);
displayImages();//这是你的事,你做了多少次。。。
}否则{
e、 printStackTrace();
Log.v(“错误”,例如getMessage());
}
}否则{
//TODO://如果不是图像,请重新注册LocaListener
MakeSnapshot(“附近没有图像”);
}
}
});