更新时间:2022-12-05 17:20:52
正如您在您的评论提到,该文档的Deezer说,DialogListener有3种方法:
onCancel()的onComplete(束值),onException的(例外的例外)。
As you mention in your comment, the Deezer doc says that DialogListener has 3 methods: onCancel(), onComplete(Bundle values), onException(Exception exception).
所以,你必须实现只有这3个功能。
So you have to implements ONLY these 3 functions.
@Override
public void onComplete(Bundle values) {
// store the current authentication info
SessionStore sessionStore = new SessionStore();
sessionStore.save(mDeezerConnect, LoginActivity.this);
// Launch the Home activity
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
}
@Override
public void onCancel() {
Toast.makeText(LoginActivity.this, R.string.login_cancelled, Toast.LENGTH_LONG).show();
}
@Override
public void onException(Exception e) {
// ...
}
和删除其他方法:onError的,等等。也许你的例子,正如你提到的,对于SDK的另一个版本。
And remove the other methods: onError, etc. Maybe you example, as you suggest, is for another version of the SDK.
请注意:我不使用Android的工作室,但在Eclipse你有一个命令来自动创建需要的方法(空,以提'TODO')。也许同样存在于Android的工作室?
Note: I don't use Android Studio, but in Eclipse you have a command to automatically create needed methods (empty, with mention 'TODO'). Maybe the same exists in Android Studio?