Get Exception when showing Alert Dialog from Service.
Following is the code in my Service class: I am trying to show an AlertDialog.
But I get the error: Una
Try this.
AlertDialog.Builder alertDialog = new AlertDialog.Builder(myContext);
Edit.
Sorry about no comment. Put Context which started your service like a instance in service and use it.
class SomeService
{
private final Context myContext;
public WebService(Context myContext)
{
this.myContext= myContext;
}
public void showDialog()
{
AlertDialog d = new AlertDialog.Builder(myContext);
}
}