I would like to show a dialog, for example, when I use showDialog (...) in Activity, but I need to do this in widgets, so I can not use showDialog (...). How can i do this?
I tried this with my onReceive method, but it fails:
AlertDialog.Builder builder; builder = new AlertDialog.Builder(context); builder.setMessage("Are you sure?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { db.open(); db.remove_last(); db.close(); dialog.dismiss(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show();
Thanks Valerio
source share