我試圖授權我的手機應用程序與facebook,但是當facebook授權窗口關閉時,它不會回到我的應用程序的continueLoading(1)方法.. 無法理解爲什麼:android授權與facebook
private void authorizeFacebook(final Loader loader) {
String[] permissions = new String[] {"friends_status", "user_status"};
facebook.authorize(this, permissions , new DialogListener() {
@Override
public void onComplete(Bundle values) {
Log.e("finish", "oncomplete");
//SharedPreferences.Editor editor = mPrefs.edit();
//editor.putString("access_token", facebook.getAccessToken());
//editor.putLong("access_expires", facebook.getAccessExpires());
//editor.commit();
loader.continueLoading(1);
}
@Override
public void onFacebookError(FacebookError error) {
Log.i("FacebookAuthorize", error.toString());
app.alert("Facebook Connection Error", "Please try to re-open the application", "Ok", loader);
}
@Override
public void onError(DialogError e) {
Log.i("FacebookAuthorize", e.toString());
app.alert("Facebook Connection Error", "Please try to re-open the application", "Ok", loader);
}
@Override
public void onCancel() {
Log.i("FacebookAuthorize", "onCancel");
app.alert("Facebook Connection Error", "Please try to re-open the application", "Ok", loader);
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
裝載機的第一步:
private void continueLoading(int step) {
switch(step)
{
//loading current user facebook profile
case 1: progressBar.incrementProgressBy(750);
loadingStatus.setText("Getting user's facebook details");
facebookRunner = new AsyncFacebookRunner(facebook);
facebookConnection = new FacebookConnection(this, 1);
facebookRunner.request("me",facebookConnection);
app.setFacebook(facebook);
app.setFacebookRunner(facebookRunner);
break;
回來我的應用程序,它只是接近的一切,而不是..
這條線會做什麼? loader.continueLoading(1); – Venky
它繼續加載...我會將它添加到我的問題 –
登錄成功後,如果您需要移動到新的活動說Activity_1,然後添加此行startActivity(new Intent(this,Activity_1.class)); – Venky