1. 程式人生 > >android.view.WindowLeaked:Activity has leaked window

android.view.WindowLeaked:Activity has leaked window 阿新 發佈:2019-01-22

E/WindowManager: android.view.WindowLeaked: Activity com.activity.LoginActivity has leaked window [email protected][] that was originally added here
       at android.view.ViewRootImpl.<init>(ViewRootImpl.java:428)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:337)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
       at android.app.Dialog.show(Dialog.java:332)
看提示是視窗洩露。

錯誤原因是因為activity中的Dialog、PopupWindow不能脫離activity而單獨存在。當Dialog、PopupWindow正在顯示的時候而它們依附的activity卻destroy了,就會出現WindowLeaked異常。

解決辦法是在finish 某個activity之前要確保依附於其上的Dialog、PopupWindow已經dismiss

@Override
    protected void onDestroy() {
        super.onDestroy();
        if(progressDialog!=null&&progressDialog.isShowing()) {
            progressDialog.dismiss();
        }
    }
也可在OnCreateDialog()中建立Dialog,讓系統去管理對話方塊。

相關推薦

android.view.WindowLeaked:Activity has leaked window <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87c3e2e4e8f5d1eee2f0c7be

E/WindowManager: android.view.WindowLeaked: Activity com.activity.LoginActivity has leaked window [email protected][] that was origi

ShortVideoPlayActivity has leaked window <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8aceefe9e5f8dce3effdcab3ecb8efebb8be

報錯檔案:  android.view.WindowLeaked: Activity com.gdvictor.dbconductorcenter.activity.ShortVideoPlayActivity has leaked window [email protec

解決has leaked ServiceConnection <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="beddd1d390dcdfd7dacb90d2d1dddfcad7d1d090ddfe8a

裝載:https://blog.csdn.net/u011057161/article/details/50474677 解決“has leaked ServiceConnection [email protected] that was originally bound here”的錯

Unable to add window <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff9e919b8d90969bd189969a88d1a9969a88ad90908bb6928f93dba8

報錯 Unable to add window [email protected] – the specified window type 0 is not valid 解決辦法 通過WindowManager給Window新增控制元件時,需

android.view.WindowManager$BadTokenException: Unable to add window -- token <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2

android.view.WindowManager$BadTokenException: Unable to add window – token [email protected] is

android Studio 出現:Unable to resolve dependency for ':<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b2a3b3b0b2f2e293e2c

li經千辛萬苦,我的新工程gradle搞定了 但是卻在變異的時候告訴我 Unable to resolve dependency for ':[email protected]/compileClasspath'xxx 等等,導致我的所有的依賴都拿不下來 我去,這不是要我的命嗎 然後又是一

Android探究之<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9cdbeff3f2dccff9eef5fdf0f5e6f9f8d2fdf1f9">[email protected]a

@SerializedName註解的意義 當我們使用Gson解析Json資料時都會建立一個對應實體類,有時候Json資料裡面的欄位是Java關鍵詞或者Json資料裡面的欄位太簡單,我們想在實體類中自定義欄位名,這時就可以用@SerializedName註解。 @SerializedName註解,不管是物件

Android studio 下載依賴時出現Unable to resolve dependency for ':<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8feeffffcfebeaed

Android studio下載依賴時出現無法解析':app @ debug / compileClasspath'的依賴關係錯誤。 原因安裝Android studio時設定了代理或映象伺服器。  解決方法,在C盤中找到.gradle資料夾(一般都是C盤)如我的位置在用記事本開啟.g

升級 android studio 報錯Unable to resolve dependency for ':<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="026372724266676077

根據日誌裡顯示 http 127.0.0.1 。。。 總是無法build,確定是studio引入了本地的ip所以無法下載更新,於是在我們的studio中開啟System Settings 中的 Http Proxy看是否選擇的是 No proxy, 1 選擇了No proxy 如果是,就

Android 圖片適配使用<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="91f8fee2a3d1">[email protected]a>圖原理解析

在很多公司開發,可能公司只提供一套ios [email protected],[email protected],[email protected]圖片。本文以蘋果6為設計標準 1.首先解釋下android系統下dpi dpi是“dot pe

android 新增依賴出現Failed to resolve:"你新增的依賴名" 或者出現 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="30545552455770735f5d40595c55

首先出現的問題是 [email protected]的問題,經過一波百度之後都說是AS build.gradle版本3.0以上的問題,但是經過一波修改之後並沒有什麼卵用,並沒有解決這個問題,並且出現了新的問題,就是Failed to resolve:.......

Android Studio 3.0.1 gradle編譯報錯 Error : unable to resolve dependency for <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0c1

在app目錄下build.gradle中引用了第三方類庫,gradle編譯時不斷報錯,無法resolve第三方類庫,或者無法download第三方類庫dependencies { implementation fileTree(include: ['*.jar'],

Android在<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d2a04192d223e2e">[email protected]a>新建專案並上傳原生代碼

1.試了網上幾種方式,但都效果不佳 2.工具:[email protected] + android Studio 3.步驟:1⃣️先在git上新建Android專案 4.在本地A

Android Studio報錯Unable to resolve dependency for ':<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="721302023200171e">[email&#

Android Studio報錯Unable to resolve dependency for’:[email protected]/compileClasspath’:無法引用任何外部依賴的解決辦法 Android Studio 在引用外部依賴時

Android studio提交程式碼到<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8ffd1ccf8f7ebfb">[email protected]a>

2,有Android studio開發環境 3,在OSC上建立專案 4,android studio建立本地專案,create git repository,選擇當前專案的根目錄: 5,以下為命令列操作:開啟本地的git bash命令列工具,cd進入專案資料夾位置,

android studio更新3.2遇到的坑,unable to resolve dependency for <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5a3b2a2a1a7474747474

距離第一次寫部落格轉眼一週多了,為什麼一直沒寫,真的這個過程中遇到了一些棘手的小麻煩 android studio更新3.2遇到的坑 4天前手賤更新了studio,然後新建工程就一堆報錯,照著網上的很多類似的部落格進行了處理,總結了一下無非以下幾種 1、降低依

android手機高精度定時機制--higher timer tick 筆記版 轉載請註明出處--- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b2839243838202e39252

作者   [email protected] 沒想到這篇隨意記錄的筆記成為老夫部落格裡閱讀量最多的。看來這的確是兄弟們關注較多的地方,待老夫抽時間把這個部分重新整理下,寫一個從核心到應用API的更新吧。 這裡簡單說一下android系統定時的原理。 首先,萬佛歸

shell腳本中的$# $0 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f8dcb8">[email protected]a> $* $$ $! $?的意義

腳本 $* width 上一個 pre shell int .cn height 轉載自:http://www.cnblogs.com/davygeek/p/5670212.html 今天學寫腳本遇到一些變量不認識,在此做下記錄。 變量 含義 $0 當前腳本的文件

shell中$*與<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b296f2">[email protected]a>的區別

劃分 位置 一個 這也 差異 獨立 [email protected] 情況 雙引號 $*所有的位置參數,被作為一個單詞 註意:"$*"必須被""引用 [email protected] 與$*同義,但是每個參數都是一個獨立的""引用字串,這就意味著參數