如何在parse.com和Android平台上获得指针值?

时间:2014-11-17 08:36:07

标签: android pointers parse-platform

我正在开发parse.com和Android平台。在我的_User表中,我有一个指针列Info<pointer>,我想得到该列的值。对于其他列,我可以轻松获得如下值:

final ParseUser user = ParseUser.getCurrentUser();

String currentUserId = user.getCurrentUser().getObjectId();
    String currentUserFirstName = user.getString("firstName");
    String currentUserLastName = user.getString("lastName");
    String currentUserEmail = user.getCurrentUser().getEmail();

但是当我为info<pointer Value>列做同样的事情时,我没有得到任何价值:

String infoPointer = user.getString("info");

1 个答案:

答案 0 :(得分:4)

我刚刚解决了我的问题。它的工作原理是使用CallBackMethod:

public static ParseObject user= new ParseObject("UserInfo");
user.getParseObject("info").fetchIfNeededInBackground(new GetCallback<ParseObject>() {

        @Override
        public void done(ParseObject object, ParseException e) {
            // TODO Auto-generated method stub
            ParseObject userinfo = object;
            String doctor = userinfo.getString("door");
            String allergies = userinfo.getString("algies");
            String medicalNote = userinfo.getString("mediote");
            String medications = userinfo.getString("medic");
            String medicalCondition = userinfo.getString("medicalCondition");

            docInfo.setText(doctor);
            medication.setText(medications);
            medNotes.setText(medicalNote);
            medCond.setText(medicalCondition);
            alergiesReact.setText(allergies);

            Log.i("userinfo", "" + userinfo);
        }
    });