Hi guys,
if you are facing this problem then it is problem with your context which you are passing in the AlertDialog, so make sure you are passing the Context which is initialized by
Context context = this;
And some times in case of Service, you can face this problem while you are using the correct Context. In that case use the following code before show() method.
AlertDialog ad; // code for creating. .create(); ad.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); ad.show();
It will work.
3 comments:
I have spent lot of time to solve this issue.It really helped me.
Very helpful sharing..thanks
@Nabeel ...thanks for appreciation
Thanks, thanks!!
Post a Comment