Monday, March 3, 2014

Custom Toast and Alert Dialog in Android Example

No comments :
Hi,

This is an Example for Custom toast and Alert Dialog in Android Example. We can use this Alert and Custom Toast Project in Android Example.

Using handler that receives messages from the thread and update the progress.

we can create that show Toast and show Dialog method in Main Activity class.


// sending error message to handler
public void showToast(int show_toast, int error, int error_layout,
String message) {
Message msg = handler.obtainMessage();
msg.what = show_toast;
msg.arg1 = error;
msg.arg2 = error_layout;
msg.obj = message;
msg.sendToTarget();

}

// sending success message to handler
public void showAlert(int show_alert, String message2) {
Message msg = handler.obtainMessage();
msg.what = show_alert;
msg.obj = message2;
msg.sendToTarget();
}

 Output is shown below






Download this project


No comments :

Post a Comment