1. java.lang.IllegalArgumentException: View not attached to window manager
  2. 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析

Quick Answer:

@Override
protected void onPostExecute(MyResult result) {
    try {
        if ((this.mDialog != null) && this.mDialog.isShowing()) {
            this.mDialog.dismiss();
        }
    } catch (final IllegalArgumentException e) {
        // Handle or log or ignore
    } catch (final Exception e) {
        // Handle or log or ignore
    } finally {
        this.mDialog = null;
    }  
}

但是,請也一併注意 Don't Catch Generic Exception | Android Code Style Guidelines for Contributors

Comments

comments powered by Disqus
Copyright © 2013 Andro Chen
Powered by Logdown and Greyshade
Favicon from The Noun Project