我在parse.com上有一个名为“MQOD”的类,它有几个颜色,我想得到DeviceId List并用我的设备检查它,如果那个数组包含我的deviceId,我想得到所有数据从那一行。我在parse.com的表如下,
我试过如下,这给了我数组的大小,但我不知道如何为我的deviceId检查该数组,并获取该行的数据。
码
ParseQuery<ParseObject> query = ParseQuery.getQuery("MQOD");
query.whereExists("DeviceId");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> ClientList, ParseException e) {
if (e == null) {
Log.d("DeviceId", "Retrieved " + ClientList.size()
+ " DeviceId");
System.out
.println("::::::::::::::::::MY arrayList:::::::::::::from Parsde.::::::::::::::::"
+ ClientList.toString());
Log.d("Installation date", "Retrieved "
+ ClientList.get(1).get("InstalationDate")
+ " DeviceId");
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
答案 0 :(得分:1)
我有答案,我已经更改了我的代码,我解决了我的问题 的码强>
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("MQOD");
// query.orderByDescending("createdAt");
query.whereEqualTo("DeviceId", android_id);
// query.toString();
System.out.println("::::::::::::::::::QUERY:::::::::::::::" + query);
try {
ob = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
if (ob.size() > 0) {
// IS INSTALLED ON DEVICE..!!!
for (ParseObject mediObject : ob) {
Const.DeviceId = mediObject.get("DeviceId").toString();
Const.InstDate = mediObject.get("InstallationDate").toString();
Const.UpDate = mediObject.get("NextSubscription").toString();
}
}catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}