1. 程式人生 > >Android9.0下對話方塊不展示,延遲500毫秒後解決

Android9.0下對話方塊不展示,延遲500毫秒後解決

解決前:

override fun onMinTimeHangUp() {
        if(activity == null) return
        val dialog = AudioReportDialog(activity!!)
        if(activity is CrushMainActivity){
            (activity as CrushMainActivity).enqueueDialog(dialog)
            (activity as CrushMainActivity).diaLogsShow()
        }
        
    }

解決後(延遲500毫秒,彈出):

    //通話小於30秒   通知彈窗
    override fun onMinTimeHangUp() {
        if(activity == null) return
        
        MainThreadHandler.postOnUiThreadDelayed({
            if(activity is CrushMainActivity){
                val dialog = AudioReportDialog(activity!!)
                (activity as CrushMainActivity).enqueueDialog(dialog)
                (activity as CrushMainActivity).diaLogsShow()
            }
        }, 500)

    }

產生原因: