【发布时间】:2020-08-23 20:06:13
【问题描述】:
由于退出按钮在片段上,我不能将“this”用作 Activity,我可以用什么替换?
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(this,gso);
错误信息
error: no suitable method found for getClient(DashboardFragment,GoogleSignInOptions)
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(this,gso);
^
method GoogleSignIn.getClient(Context,GoogleSignInOptions) is not applicable
(argument mismatch; DashboardFragment cannot be converted to Context)
method GoogleSignIn.getClient(Activity,GoogleSignInOptions) is not applicable
(argument mismatch; DashboardFragment cannot be converted to Activity)
【问题讨论】:
标签: android android-studio google-authentication