Posts

Showing posts with the label Alert Dialog

Custom Dialog With Call Back in Android

Image
What is Dialog in Android : A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed. Create Custom Layout :   If you want a custom layout in a dialog, create a layout and add it to an AlertDialog by calling setView() on your AlertDialog.Builder object or add it to  Dialod by calling setContentView() on your Dialog object. . Dialog Methods : cancel() : Cancel the dialog. dismiss() : Dismiss the dialog. Removing it from screen . setContentView(int resId) : Set the screen content from layout resource. setCanceledOnTouchOutside(boolean cancel) : Sets whether this dialog is canceled when touched outside the window's bounds.  setCancelable(boolean value) : Sets whether this dialog is cancelable with the BACK key.  requestWindowFeature(int featuredId) : Enable extend...

Alert Dialog in Android

Image
A Dialog is small window that prompts the user to a decision or enter additional information.The   AlertDialog   class allows you to build a variety of dialog designs and is often the only dialog class you'll need. Title   This is optional and should be used only when the content area is occupied by a detailed message, a list, or custom layout. If you need to state a simple message or question you don't need a title. Content area   This can display a message, a list, or other custom layout. Action buttons   There should be no more than three action buttons in a dialog. for details click  here Example :   AlertDialog . Builder alertDialogBuilder = new AlertDialog . Builder ( this ); alertDialogBuilder . setMessage ( "Are you sure, You want to exit" ); alertDialogBuilder . setPositiveButton ( "yes" , new DialogInterface . OnClickListener () { @Override public void onClick ( DialogInterface...