android activity has leaked window com.android.internal.policy.impl.phonewindow$decorview Issue

后端 未结 8 786
再見小時候
再見小時候 2020-11-28 05:56

I am working with Android application to show network error.

NetErrorPage.java

package exp.app;

import android.app.Activity;
impor         


        
8条回答
  •  借酒劲吻你
    2020-11-28 06:22

    I got this error but it is resolved interesting. As first, i got this error at api level 17. When i call a thread (AsyncTask or others) without progress dialog then i call an other thread method again using progress dialog, i got that crash and the reason is about usage of progress dialog.

    In my case, there are two results that;

    • I took show(); method of progress dialog before first thread starts then i took dismiss(); method of progress dialog before last thread ends.

    So :

    ProgresDialog progressDialog = new ...
    
    //configure progressDialog 
    
    progressDialog.show();
    
    start firstThread {
    ...
    }
    
    ...
    
    start lastThread {
    ...
    } 
    
    //be sure to finish threads
    
    progressDialog.dismiss();
    
    • This is so strange but that error has an ability about destroy itself at least for me :)

提交回复
热议问题