我编写了以下代码片段以在使用linkedIn 登录后获取用户详细信息。但是点击按钮后,什么也没有发生。我将如何被重定向到linkedin 登录页面?请帮忙
公共类 MainActivity 扩展 Activity {
SocialAuthAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final SocialAuthAdapter adapter = new SocialAuthAdapter(new ResponseListener());
Button linkedin_button = (Button)findViewById(R.id.button1);
//adapter.enable(linkedin_button);
linkedin_button.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
adapter.authorize(MainActivity.this, Provider.LINKEDIN);
}
});
}
private final class ResponseListener implements DialogListener
{
public void onComplete(Bundle values) {
//SocialAuthAdapter adapter = null;
adapter.getUserProfileAsync(new ProfileDataListener());
}
}
// 认证后接收配置文件响应 private final class ProfileDataListener implements SocialAuthListener {
public void onExecute(Profile t) {
Log.d("Custom-UI", "Receiving Data");
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", "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());
}
}
http://www.3pillarglobal.com/blog/part-2-using-socialauth-integrate-linkedin-api-android