Search code examples
androidpointersparse-platform

How to get pointer value in parse.com and Android platforms?


I am working on the parse.com and Android platforms. In my _User table I have a Pointer Column Info<pointer>, I want to get the value of that column. For other columns I can easily get the values like:

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

But when I do the same thing for info<pointer Value> column I don't get any value:

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

Solution

  • I have just solved my problem. It works by using 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);
            }
        });