Activilty泄露了最初添加到此处的窗口com.android.internal.policy.impl.PhoneWindow$DecorView@42acff18

时间:2015-09-06 07:59:01

标签: android onedrive live-sdk

我正在使用LiveSDK登录Onedrive。它正在运行,但在标志页和授权页面上的旋转设备上显示警告。

Activilty泄露了最初添加的窗口com.android.internal.policy.impl.PhoneWindow$DecorView@42acff18 ......

代码如下

class SigninActivity extends Activity implements LiveAuthListener {
private LiveAuthClient signinauth;
public LiveConnectClient client;
private boolean signin = false;
public static final String[] SCOPES = {
        "wl.signin",
        "wl.basic",

};

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);
}

@Override
public void onResume() {
    super.onResume();
    if (this.signinauth == null) {
        this.signinauth = new LiveAuthClient(this, LiveSdkContants.CLIENT_ID);
        this.signinauth.login(this, Arrays.asList(SCOPES), this);
    }
    if (signin) {
        System.out.println("Authorization Success");
        finish();
    }
}
public void onDestroy() {
    super.onDestroy();

}
public void onAuthComplete(LiveStatus status, LiveConnectSession session, Object userState) {
    if (status == LiveStatus.CONNECTED ) {
        System.out.println("Connected");
        signin = true;
        client = new LiveConnectClient(session);
        finish();
    } else {
        client = null;
        signin = false;
        finish();
    }
}

        public void onAuthError(LiveAuthException exception, Object userState) {
    client = null;
    System.out.println("Connection failed");
    this.finish();
}

我如何解决这个问题?

活动已泄露最初添加的窗口com.android.internal.policy.impl.PhoneWindow$DecorView@41d3cf88             在android.view.ViewRootImpl。(ViewRootImpl.java:402)             在android.view.WindowManagerImpl.addView(WindowManagerImpl.java:311)             在android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)             在android.view.WindowManagerImpl $ CompatModeWrapper.addView(WindowManagerImpl.java:149)             在android.view.Window $ LocalWindowManager.addView(Window.java:554)             在android.app.Dialog.show(Dialog.java:277)             在com.microsoft.live.AuthorizationRequest.execute(AuthorizationRequest.java:344)             在com.microsoft.live.LiveAuthClient.login(LiveAuthClient.java:504)             在com.microsoft.live.LiveAuthClient.login(LiveAuthClient.java:427)             在com.onedrive.SigninActivity.onResume(SigninActivity.java:303)             在android.support.v4.app.Fragment.performResume(Fragment.java:1832)             在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)             在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)             在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1120)             在android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1939)             在android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:447)             在android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:436)             在android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:138)             在android.app.Activity.performResume(Activity.java:5293)             在android.app.ActivityThread.performResumeActivity(ActivityThread.java:2606)             在android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2644)             在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2130)             在android.app.ActivityThread.access $ 600(ActivityThread.java:140)             在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1227)             在android.os.Handler.dispatchMessage(Handler.java:99)             在android.os.Looper.loop(Looper.java:137)             在android.app.ActivityThread.main(ActivityThread.java:4898)             at java.lang.reflect.Method.invokeNative(Native Method)             在java.lang.reflect.Method.invoke(Method.java:511)             在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1006)             在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)             在dalvik.system.NativeStart.main(本地方法)

1 个答案:

答案 0 :(得分:0)

当您的父 <dependency> <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-all</artifactId> <version>2.2.2</version> </dependency> 打开任何亲属Activity时,会出现此异常。如果父活动停止,而未关闭Foreground,则Dialog将超出错误。

备注: (1)您应该每次都检查Activity方法,如果您的对话框已打开,请先关闭该对话框。

(2)在您的活动上调用onStop()之前,您应该每次打开时关闭Dialog