Java 没有打电话到;super.onPostCreate();使用Google Play Services API时
允许Google+登录Android。我必须使用谷歌播放服务API。我使用的是来自的精确代码。然而。每次运行它时,我都会从OnClickListener和GoogleAppClientBuilder重定向到名为ActivityThread的播放服务类 在ActivityThread中,我登录到的代码是:Java 没有打电话到;super.onPostCreate();使用Google Play Services API时,java,android,google-plus,google-play-services,Java,Android,Google Plus,Google Play Services,允许Google+登录Android。我必须使用谷歌播放服务API。我使用的是来自的精确代码。然而。每次运行它时,我都会从OnClickListener和GoogleAppClientBuilder重定向到名为ActivityThread的播放服务类 在ActivityThread中,我登录到的代码是: if (!activity.mCalled) { throw new SuperNotCalledException( "Activity " + r.inten
if (!activity.mCalled) {
throw new SuperNotCalledException(
"Activity " + r.intent.getComponent().toShortString() +
" did not call through to super.onPostCreate()");
}
我已尝试从以下位置更改代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSignIn = (SignInButton) findViewById(R.id.btn_sign_in);
btnSignOut = (Button) findViewById(R.id.btn_sign_out);
btnRevokeAccess = (Button) findViewById(R.id.btn_revoke_access);
imgProfilePic = (ImageView) findViewById(R.id.imgProfilePic);
txtName = (TextView) findViewById(R.id.txtName);
txtEmail = (TextView) findViewById(R.id.txtEmail);
llProfileLayout = (LinearLayout) findViewById(R.id.llProfile);
// Button click listeners
btnSignIn.setOnClickListener(this);
btnSignOut.setOnClickListener(this);
btnRevokeAccess.setOnClickListener(this);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this).addApi(Plus.API, null)
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
}
致:
此更改没有任何影响,活动仍被发送到同一个“未通过调用super.onPostCreate()调用”部分
这似乎不仅仅影响OnCreate,而是在整个活动中使用Google Play服务的任何时候
我不确定为什么会发生这种情况,这是我如何添加Google Play服务的问题还是我应该使用不同的代码?我刚刚升级到最新的Google Play服务,现在在我的启动活动中收到了相同的错误,甚至没有覆盖onPostCreate。我刚开始研究这个问题,但我的假设是,这与发生错误时处于活动状态的活动没有任何关系。我也收到了这个错误-我最近将ArrayAdapter更改为BaseAdapter,现在当我尝试调用setListAdapter(BaseAdapter)时,会引发异常。但也许里奇是对的
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSignIn = (SignInButton) findViewById(R.id.btn_sign_in);
btnSignOut = (Button) findViewById(R.id.btn_sign_out);
btnRevokeAccess = (Button) findViewById(R.id.btn_revoke_access);
imgProfilePic = (ImageView) findViewById(R.id.imgProfilePic);
txtName = (TextView) findViewById(R.id.txtName);
txtEmail = (TextView) findViewById(R.id.txtEmail);
llProfileLayout = (LinearLayout) findViewById(R.id.llProfile);
}
@Override
protected void onPostCreate(Bundle savedInstanceState){
super.onPostCreate(savedInstanceState);
// Button click listeners
btnSignIn.setOnClickListener(this);
btnSignOut.setOnClickListener(this);
btnRevokeAccess.setOnClickListener(this);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this).addApi(Plus.API, null)
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
}