将解析键值分配给字符串

时间:2015-04-23 17:11:27

标签: android parse-platform

我在数据库中的ParseObject名为" Ads"它有两个标题和价格。 如何在字符串" t"中分配键标题的值? 和#34; p"?

中的价格值

这是我的代码

public static class ViewHolder extends RecyclerView.ViewHolder {
    String t;
    String p;

    public ViewHolder(View itemView) {
        super(itemView);
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Ads");
        query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() {
            public void done(ParseObject object, ParseException e) {
                if (e == null) {
                    // object will be your game score
                } else {
                    // something went wrong
                }
            }

            @Override
            public void done(ParseObject parseObject, com.parse.ParseException e) {

            }
        });
    }
}

1 个答案:

答案 0 :(得分:0)

ParseObject是可以从Parse云中保存和检索的数据的本地表示。

public static class ViewHolder extends RecyclerView.ViewHolder {
    String t;
    String p;

    public ViewHolder(View itemView) {
        super(itemView);
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Ads");
        query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() {
             public void done(ParseObject object, ParseException e) {
                 if (e == null) {
                     t = object.getString("ColumnName")
                     p = object.getString("ColumnName")
                 } else {
                     //objectRetrievalFailed
                 }
             }
        });
    }
}