使用SocialAuth api显示个人资料详细信息

时间:2014-11-29 10:45:07

标签: android socialauth

我有一个项目,我发现here。它的社交连接api常用于将我们的应用程序与社交网络应用程序连接起来。该项目工作正常。 我只需要在日志cat中显示用户配置文件详细信息。 我尝试了以下代码,该代码在教程here中给出:

private final class ResponseListener implements DialogListener {
    @Override
    public void onComplete(Bundle values) {
        adapter.getUserProfileAsync(new ProfileDataListener());                   

}
private final class ProfileDataListener implements SocialAuthListener<Profile> {

    public void onExecute(Profile t) {

       Log.d("Custom-UI", "Receiving Data");
       Profile profileMap = t;
       Log.d("received profile info",t.toString());

       Log.d("Custom-UI",  "Validate ID         = " + profileMap.getValidatedId());
       Log.d("Custom-UI",  "First Name          = " + profileMap.getFirstName());
       Log.d("Custom-UI",  "Last Name           = " + profileMap.getLastName());

       /* Log.d("Custom-UI",  "Email             = " + profileMap.getEmail());
       Log.d("Custom-UI",  "Country             = " + profileMap.getCountry());
       Log.d("Custom-UI",  "Language            = " + profileMap.getLanguage());
       Log.d("Custom-UI",  "Location            = " + profileMap.getLocation());
       Log.d("Custom-UI",  "Profile Image URL   = " + profileMap.getProfileImageURL());*/

    }

    @Override
    public void onError(SocialAuthError arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onExecute(String arg0, Profile arg1) {
        // TODO Auto-generated method stub

    }

}

LogCat不会打印个人资料详细信息。有人可以使用给定的链接进行更改吗?

1 个答案:

答案 0 :(得分:0)

像这样更新你的代码。

private final class ProfileDataListener implements SocialAuthListener<Profile> {

@Override
public void onError(SocialAuthError arg0) {
    // TODO Auto-generated method stub

}

@Override
public void onExecute(String arg0, Profile t) {

       Log.d("Custom-UI", "Receiving Data");
       Log.d("Custom-arg0", arg0);
       Profile profileMap = t;
       Log.d("Custom-UI",  "Validate ID         = " + profileMap.getValidatedId());
       Log.d("Custom-UI",  "First Name          = " + profileMap.getFirstName());
       Log.d("Custom-UI",  "Last Name           = " + profileMap.getLastName());
       Log.d("Custom-UI",  "Email               = " + profileMap.getEmail());
       Log.d("Custom-UI",  "Gender                   = " + profileMap.getGender());
       Log.d("Custom-UI",  "Country                  = " + profileMap.getCountry());
       Log.d("Custom-UI",  "Language                 = " + profileMap.getLanguage());
       Log.d("Custom-UI",  "Location                 = " + profileMap.getLocation());
       Log.d("Custom-UI",  "Profile Image URL  = " + profileMap.getProfileImageURL());
}
}