相关疑难解决方法(0)

意图服务中的Android Alert对话框

我想在intent服务中显示一个警告对话框.

   AlertDialog alertDialog = new AlertDialog.Builder(this).create();
Run Code Online (Sandbox Code Playgroud)

这会引发以下异常

   Unable to add window — token null is not for an application
Run Code Online (Sandbox Code Playgroud)

我也尝试过IntentService.this和getApplicationContext().之间我不想使用活动.我只是想用一个小文本显示一个简单的警告对话框.

android android-intent intentservice android-alertdialog

12
推荐指数
2
解决办法
3万
查看次数