I am developing an android app where I am dealing with sending and receiving information to and from our servers.Please let me know when any sort of exception occurs I am trying to show an alertbox, but the issue is that the alert box is not displayed always. Please help me with a solution so that when ever an exception takes place some sort of friendly UI is to be displayed.
The AlertBox I am using
public void Alertbox(String title, String mymessage,Context context ) {
new AlertDialog.Builder(context)
.setMessage(mymessage)
.setCancelable(true)
.setNeutralButton(android.R.string.ok,new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog,int whichButton) {
}
}).show();
}
public static void ProcessDialogue(String title,Context context)
{
}
Create ErrorBroadcastReceiver and Error ACTION with Extras string.
and send broadcast intents to this receiver