Android examples for User Interface:Alert Dialog
show Modal Alert Window With OK
import java.util.Calendar; import java.util.List; import android.content.Context; import android.content.DialogInterface; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.MeasureSpec; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.widget.Button; import android.widget.DatePicker; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TimePicker; import android.widget.Toast; public class Main{ /** mAlertWindow */ private static AlertWindow mAlertWindow; public static void showModalAlertWindowWithOK(Context context, String msg) {/*from w w w .ja va2 s . co m*/ int style = AlertWindow.HAS_OK; AlertWindow aw = new AlertWindow(context, style); mAlertWindow = aw; aw.setMessage(msg); aw.setButtonListener(new AlertWindow.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); } }, null); aw.setCancelable(false); aw.setCanceledOnTouchOutside(false); aw.setClosable(false); aw.show(); } }