我在解析时检索对象,但它总是转到ParseException
这是我的代码:
public void setItemListData(Context context, String className,
String[] value, String colName) {
ParseQuery query = new ParseQuery(className);
query.whereContainsAll("Store",Arrays.asList (value));
query.whereEqualTo("Store","Asus");
dataList = new ArrayList<String>();
try {
List<ParseObject> dataHolder = query.find();
for(int counter =0;counter<dataHolder.size();counter++){
String datas = dataHolder.get(counter).getString(colName);
dataList.add(datas);
}
} catch (ParseException e) {
Toast.makeText(context,"No Internet Connection",
Toast.LENGTH_SHORT).show();
}
}
我不知道我的代码有什么问题
提前致谢
答案 0 :(得分:1)
Change query.whereContainsAll("Store",Arrays.asList (value));
到
query.whereContainedIn("Store",Arrays.asList (value));
答案 1 :(得分:0)
在单个查询中找到多个值:
private List<ParseObject> todos;
查找多个值的代码:
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Your_Class_Name");
String[] names = {"Hiren", "Dhruv", "Pratik", "Miral", "Kirit"};
query.whereContainedIn("Your_Column_Name_Means_Key", Arrays.asList(names));
try {
todos = query.find();
Log.i("No Of Record Found",todos.size()+"");
}catch (ParseException e) {
e.printStackTrace()
}
您必须传递您的类名和您的列名。
完成强>