1

我正在检索解析中的对象,但它总是去 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();
        }
    }

我不知道我的代码有什么问题

提前致谢

4

2 回答 2

1
Change query.whereContainsAll("Store",Arrays.asList (value)); 

query.whereContainedIn("Store",Arrays.asList (value));
于 2013-03-01T11:12:25.790 回答
1

在单个查询中查找多个值:

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()
        }

您必须传递您的Class NameYour Column Name

完毕

于 2015-06-13T12:53:28.977 回答