Java Android在等待时从前端关闭应用程序,但该过程在后台仍处于活动状态
我有一个使用google plus注册的应用程序,我的问题是: 调用Java Android在等待时从前端关闭应用程序,但该过程在后台仍处于活动状态,java,android,Java,Android,我有一个使用google plus注册的应用程序,我的问题是: 调用mgoogleapclient.connect()后然后我无事可做,只能等待gPlus的响应失败onConnectionFailed或onConnected 但在等待奇怪的事情发生时,我的手机屏幕变得有点暗,就像必须弹出一个对话框,但什么也没有出现,应用程序在1,2秒后关闭一样 但是,进程仍在运行,因为当命中onConnectionFailed或onConnected时(断点),我可以在调试器中捕获它们并沿着语句移动,但在那里应
mgoogleapclient.connect()后代码>然后我无事可做,只能等待gPlus的响应失败onConnectionFailed
或onConnected
但在等待奇怪的事情发生时,我的手机屏幕变得有点暗,就像必须弹出一个对话框,但什么也没有出现,应用程序在1,2秒后关闭一样
但是,进程仍在运行,因为当命中onConnectionFailed
或onConnected
时(断点),我可以在调试器中捕获它们并沿着语句移动,但在那里应用程序(视图)通过移动关闭
有人能解释一下为什么会发生这种情况以及如何解决这个问题吗
private void activateGooglePlusLogin() {
SignInButton googlePlusSignInButton = (SignInButton) findViewById(R.id.googlePlusSignInButton);
googlePlusSignInButton.setSize(SignInButton.SIZE_WIDE);
googlePlusSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
try {
eGooglePlus googleApiObj = new eGooglePlus(Splash.this);
googleApiObj.connectGoogleApi();
TextView pleaseWait = (TextView) findViewById(R.id.pleaseWait);
pleaseWait.setText("Please wait while we register your account...");
//waitForNSeconds(10000);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void connectGoogleApi() {
mGoogleApiClient = new GoogleApiClient.Builder(mainAppContext).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
mGoogleApiClient.connect();
}