Show TOC

MAFDialog and MAFDialogWithProgressBarLocate this document in the navigation structure

The MAFDialog control extends the capabilities of the android.app.Dialog native control. MAF adds styling capabilities to the Dialog UI component.

To create and present a default SAP style instance of MAFDialog, use:
OnClickListener listener = new OnClickListener() {
                        @Override
                        public void onClick(View v) {                             
                              …
                        }
           };   

MAFDialog d = new MAFDialog(this);
           d.setPositiveButton("Yes", listener);
           d.setTitle("A very long dialog");
           d.show(); 

The MAF skinning engine customizes the dialog.

This is the XAML content for the default style of the Dialog TargetType:
Style TargetType="Dialog" Key="DefDialog" platform="android">
                 <Setter Property="Background" Value="#ffffffff" />
                 <!-- dialog background color -->
                 <Setter Property="Foreground" Value="#ff000000" />
                 <!-- dialog text color -->
                 <Setter Property="Separator" Value="#ff00a3d7" />
                 <!-- dialog separator line color -->
           </ Style > 
You can define three buttons on the MAFDialog: a positive button (Save, OK, Yes), a neutral button (Cancel, Ignore), and a negative button (Do not save, No).  Use the setter methods to set the display text and a callback listener for the onclick event for each button. The listener is a standard android.view.View.OnClickListener. This example sets all three buttons:
d.setPositiveButton("Yes", positiveListener);   
d.setNegativeButton("No", negativeListener);   
d.setNeutralButton("Cancel", neutralListener); 
MAFDialogWithProgressBar is an extension to MAFDialog that shows a progress dialog with an optional text. It does not extend the standard progress dialog class, but provides an analogous API. To create MAFDialogWithProgressBar, use:
MAFDialogWithProgressBar dialog = new MAFDialogWithProgressBar(ColorApp.this);                             
        dialog.setMessage("Dialog Text");                             
        dialog.show(); 
You can inherit the style definition from the standard dialog and create a flavored one:
<Style TargetType="Dialog" Key="FilterDialog" BasedOn="DefDialog" 
platform="android">
                 <Setter Property="Separator" Value="0" />
                 <!-- dialog separator line color -->
          </Style>
Create button from code:
MAFDialog d = new MAFDialog(this, ”flavorName”);       
MAFDialogWithProgressBar dialog = new 
MAFDialogWithProgressBar(ColorApp. this,”flavorName” ); 
You can change these properties in the skinning XML:
Background Dialog background color. Colors are defined as RGBA (red, green, blue, alpha).
Foreground Dialog text color.
Separator Dialog separator line color.