我尝试在解析中的类中下载数据,我有2个对象,它们在同一个trade_id中。但是当我将它们下载到Arraylist时它只显示1 .. 这是我的代码:
final ArrayList<Photo> photos = new ArrayList<>();
try {
ParseQuery<ParseObject> query1 = new ParseQuery<>("photo");
query1.whereEqualTo("trade_id",idTrade);
list = query.find();
for (ParseObject mPhoto : list) {
Photo newPhoto = new Photo();
newPhoto.setPhoto((File) mPhoto.get("imageFile"));
photos.add(newPhoto);
}
} catch (com.parse.ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
int photosize = photos.size();
Toast.makeText(getActivity(),""+photosize,Toast.LENGTH_LONG).show();
告诉我如何修复它? pleae!
答案 0 :(得分:0)
尝试query1.whereMatches
将返回所有可能的匹配
ParseQuery<ParseObject> query1 = new ParseQuery<>("photo");
query1.whereMatches("trade_id",idTrade);
list = query.find();