Android examples for User Interface:Alert Dialog
show Alert Window With OK No Cancel Outside
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 showAlertWindowWithOKNoCancelOutside( Context context, boolean hasTitle, String title, String message, AlertWindow.OnClickListener positiveListener) { int style = 0; if (hasTitle) { style = AlertWindow.HAS_TITLE | AlertWindow.HAS_OK; } else {/*w w w . j a v a 2 s . com*/ style = AlertWindow.HAS_OK; } AlertWindow aw = new AlertWindow(context, style); mAlertWindow = aw; aw.setTitle(title); aw.setMessage(message); aw.setButtonListener(positiveListener, null); aw.setCanceledOnTouchOutside(false); aw.show(); } }