Example usage for android.app AlertDialog.Builder setCancelable

List of usage examples for android.app AlertDialog.Builder setCancelable

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setCancelable.

Prototype

public void setCancelable(boolean flag) 

Source Link

Document

Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key.

Usage

From source file:com.filemanager.free.fragments.preference_fragments.Preffrag.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceUtils.reset();//from  www  . jav  a  2s. c  o  m
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);
    preferences = (com.filemanager.free.activities.Preferences) getActivity();
    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    final int th1 = Integer.parseInt(sharedPref.getString("theme", "0"));
    theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1;
    /*findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
    @Override
    public boolean onPreferenceClick(Preference preference) {
        ((com.filemanager.free.activities.Preferences) getActivity()).donate();
        return false;
    }
    });*/
    findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            final String[] sort = getResources().getStringArray(R.array.columns);
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.gridcolumnno);
            int current = Integer.parseInt(sharedPref.getString("columns", "-1"));
            current = current == -1 ? 0 : current;
            if (current != 0)
                current = current - 1;
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit();
                    dialog.dismiss();
                    return true;
                }
            });
            a.build().show();
            return true;
        }
    });

    findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.theme);
            int current = Integer.parseInt(sharedPref.getString("theme", "0"));
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("theme", "" + which).commit();
                    dialog.dismiss();
                    restartPC(getActivity());
                    return true;
                }
            });
            a.title(R.string.theme);
            a.build().show();
            return true;
        }
    });

    final SwitchPreference rootmode = (SwitchPreference) findPreference("rootmode");
    rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            boolean b = sharedPref.getBoolean("rootmode", false);
            if (b) {
                if (RootTools.isAccessGiven()) {
                    rootmode.setChecked(true);

                } else {
                    rootmode.setChecked(false);

                    Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                rootmode.setChecked(false);

            }
            return false;
        }
    });

    //Directory sort mode
    findPreference("dirontop").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.directorysortmode);
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.directorysort);
            int current = Integer.parseInt(sharedPref.getString("dirontop", "0"));
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("dirontop", "" + which).commit();
                    dialog.dismiss();
                    return true;
                }
            });
            a.build().show();
            return true;
        }
    });

    findPreference("sortby").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.sortby);
            int current = Integer.parseInt(sharedPref.getString("sortby", "0"));
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("sortby", "" + which).commit();
                    dialog.dismiss();
                    return true;
                }
            });
            a.title(R.string.sortby);
            a.build().show();
            return true;
        }
    });

    // Feedback
    Preference preference3 = (Preference) findPreference("feedback");
    preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "hoanghiep8899@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : File Manager");
            Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show();
            File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt");
            if (f.exists()) {
                emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
            }
            startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback)));
            return false;
        }
    });

    // rate
    Preference preference5 = (Preference) findPreference("rate");
    preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent1 = new Intent(Intent.ACTION_VIEW);
            intent1.setData(Uri.parse("market://details?id=com.filemanager.free"));
            try {
                startActivity(intent1);
            } catch (ActivityNotFoundException e) {
                e.printStackTrace();
            }
            return false;
        }
    });

    // Colored random color
    final SwitchPreference randomColor = (SwitchPreference) findPreference("random_checkbox");
    randomColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (preferences != null)
                preferences.changed = 1;
            Toast.makeText(getActivity(), R.string.setRandom, Toast.LENGTH_LONG).show();
            return true;
        }
    });
    // Colored navigation bar
    final SwitchPreference colorNavigation = (SwitchPreference) findPreference("colorednavigation");
    colorNavigation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (preferences != null) {
                preferences.changed = 1;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setTitle(getResources().getString(R.string.confirm));
            builder.setMessage(getResources().getString(R.string.themeRestart));
            builder.setPositiveButton(getResources().getString(R.string.ok),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            restartPC(getActivity());
                        }
                    });
            builder.setNegativeButton(getResources().getString(R.string.cancel),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });
            builder.setCancelable(true);
            builder.show();
            return true;
        }
    });
    if (Build.VERSION.SDK_INT >= 21) {
        colorNavigation.setEnabled(true);
    } else {
        colorNavigation.setEnabled(false);
    }

    findPreference("skin").setOnPreferenceClickListener(this);
    findPreference("fab_skin").setOnPreferenceClickListener(this);
    findPreference("icon_skin").setOnPreferenceClickListener(this);
    findPreference("extractpath").setOnPreferenceClickListener(this);
    findPreference("zippath").setOnPreferenceClickListener(this);
}

From source file:com.example.emachine.FXcalcActivity.java

private void textDialog(String title, String dialogtext) {
    // get prompts.xml view
    String returnString = "";
    hideKeyboard();//from  w w w .j  ava  2  s  .c  om
    LayoutInflater li = LayoutInflater.from(getBaseContext());
    View promptsView = li.inflate(R.layout.alertdialog_sysmsg_dialog, null);

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

    // set prompts.xml to alertdialog builder
    alertDialogBuilder.setView(promptsView);

    final EditText userInput = (EditText) promptsView.findViewById(R.id.editTextDialogUserInput);

    TextView tv_custom_dialog_title = (TextView) promptsView.findViewById(R.id.tv_custom_dialog_title);
    TextView tv_text_dialog = (TextView) promptsView.findViewById(R.id.tv_text_dialog);
    //        ImageView iv_image = (ImageView) promptsView.findViewById(R.id.iv_image);

    tv_custom_dialog_title.setText(title);
    tv_text_dialog.setText(dialogtext);

    // set dialog message
    alertDialogBuilder.setCancelable(true).setPositiveButton("Good one", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            //                EspressoMachine_AlertDialogButtonClicked("Good one", TAG);
            alert("You have chosen, Wisely. ");
            Intent intent = new Intent(getBaseContext(), FieldOfFieldsActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                startActivity(intent);
            }
            dialog.cancel();

        }
    })
            //                    public void onClick(DialogInterface dialog, int id) {     EspressoAlertDialogButtonClicked();
            //                        // get user input and set it to result
            //                        // edit text
            //                        if (!userInput.getText().toString().equals("demo") && userInput.getText().toString().equals(getprefPassword(getBaseContext()))) {
            //
            //                        } else { alert("Password incorrect");}
            //
            //                    }
            //                })
            //                .setNeutralButton("Gallery", new DialogInterface.OnClickListener() {
            //                    public void onClick(DialogInterface dialog, int id) {     EspressoAlertDialogButtonClicked();
            //                        // get user input and set it to result
            //                        // edit text
            //                        if (!userInput.getText().toString().equals("demo") && userInput.getText().toString().equals(getprefPassword(getBaseContext()))) {
            //
            //                        } else { alert("Password incorrect");}
            //
            //                    }
            //                })
            .setNegativeButton("BAD QA", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    //                        EspressoMachine_AlertDialogButtonClicked("Bad QA", TAG);
                    alert("You have chosen, Poorly! ");
                    dialog.cancel();
                }
            });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();

    alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(final DialogInterface dialog) {
            Button negativeButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
            Button positiveButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE);
            Button neutralButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEUTRAL);

            // this not working because multiplying white background (e.g. Holo Light) has no effect
            //negativeButton.getBackground().setColorFilter(0xFFFF0000, PorterDuff.Mode.MULTIPLY);

            //                final Drawable negativeButtonDrawable = getResources().getDrawable(R.color.btn_background);
            final Drawable positiveButtonDrawable = getResources().getDrawable(R.color.btn_background);
            //                final Drawable neutralButtonDrawable = getResources().getDrawable(R.color.btn_background);

            //                negativeButton.setBackground(negativeButtonDrawable);
            //        positiveButton.setBackground(positiveButtonDrawable);
            //                neutralButton.setBackground(neutralButtonDrawable);
        }
    });

}

From source file:com.fastbootmobile.encore.app.fragments.DspProvidersFragment.java

public void showAddEffect() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.add_effect);

    // Lookup all the DSP effects providers that aren't already in the chain
    final List<DSPConnection> availableDsp = PluginsLookup.getDefault().getAvailableDSPs();
    final List<ProviderIdentifier> chain = PlaybackProxy.getDSPChain();
    final List<DSPConnection> dsps = PluginsLookup.getDefault().getAvailableDSPs();

    for (ProviderIdentifier pi : chain) {
        for (DSPConnection dsp : dsps) {
            if (dsp.getIdentifier().equals(pi)) {
                availableDsp.remove(dsp);
            }/*from   www  .j a  v a  2 s.  c om*/
        }
    }

    if (availableDsp.size() > 0) {
        CharSequence[] items = new CharSequence[availableDsp.size()];
        int i = 0;
        for (DSPConnection dsp : availableDsp) {
            items[i] = dsp.getProviderName();
            i++;
        }

        builder.setItems(items, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                addEffectToChain(availableDsp.get(i));
                updateDspChain();
                dialogInterface.dismiss();
            }
        });
        builder.setIcon(R.drawable.ic_nav_listen_now);

        builder.setCancelable(true);
        builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });

        builder.show();
    } else {
        Utils.shortToast(getActivity(), R.string.all_dsp_in_use);
    }
}

From source file:com.elpstudio.player.EqualizerActivity.java

/**
 * Builds the "Apply To" dialog. Does not call the show() method, so you 
 * should do this manually when calling this method.
 * // ww  w  . ja v a  2s.  c  o m
 * @return A fully built AlertDialog reference.
 */
public AlertDialog buildApplyToDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    //Set the dialog title.
    builder.setTitle("APPLY TO");
    builder.setCancelable(false);
    builder.setItems(R.array.apply_equalizer_to_array, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            if (which == 0) {
                setEQValuesForSong(Music.musicService.currentSong.getId() + "");
                Toast.makeText(mContext, "Equalizer applied to current song.", Toast.LENGTH_SHORT).show();

                //Finish this activity.
                finish();

            } else if (which == 1) {
                AsyncApplyEQToAllSongsTask task = new AsyncApplyEQToAllSongsTask(mContext, mFragment);
                task.execute();
                dialog.dismiss();

                //Finish this activity.
                finish();

            }
            /*else if (which==2) {
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            EQArtistsListDialog artistDialog = new EQArtistsListDialog();
            artistDialog.show(ft, "eqArtistsListDialog");
                    
            dialog.dismiss();
                    
            } else if (which==3) {   
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            EQAlbumsListDialog albumsDialog = new EQAlbumsListDialog();
            albumsDialog.show(ft, "eqAlbumsListDialog");
                    
            dialog.dismiss();
                    
            } else if (which==4) {
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            EQGenresListDialog genresDialog = new EQGenresListDialog();
            genresDialog.show(ft, "eqGenresListDialog");
                    
            dialog.dismiss();
                    
            }*/

        }

    });
    // init your ImageView

    return builder.create();
}

From source file:com.wheelphone.remotemini.WheelphoneRemoteMini.java

public void msgbox(String title, String msg) {
    AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
    dlgAlert.setTitle(title);/*from   w  ww . j av a  2s  .c  om*/
    dlgAlert.setMessage(msg);
    dlgAlert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            //finish(); 
        }
    });
    dlgAlert.setCancelable(true);
    dlgAlert.create().show();
}

From source file:com.example.drugsformarinemammals.Dose_Information.java

private void displayMessage(String messageTitle, String message) {
    AlertDialog.Builder myalert = new AlertDialog.Builder(this);

    TextView title = new TextView(this);
    title.setTypeface(Typeface.SANS_SERIF);
    title.setTextSize(20);//from  w w  w .ja v  a2 s.c om
    title.setTextColor(getResources().getColor(R.color.blue));
    title.setPadding(8, 8, 8, 8);
    title.setText("Synchronization");
    title.setGravity(Gravity.CENTER_VERTICAL);

    LinearLayout layout = new LinearLayout(this);
    TextView text = new TextView(this);
    text.setTypeface(Typeface.SANS_SERIF);
    text.setTextSize(20);
    text.setPadding(10, 10, 10, 10);
    text.setText(message);
    layout.addView(text);

    myalert.setView(layout);
    myalert.setCustomTitle(title);
    myalert.setCancelable(true);
    myalert.show();

}

From source file:com.aniruddhc.acemusic.player.EqualizerActivity.EqualizerActivity.java

/**
 * Builds the "Apply To" dialog. Does not call the show() method, so you 
 * should do this manually when calling this method.
 * /*  www.jav  a 2s. co  m*/
 * @return A fully built AlertDialog reference.
 */
public AlertDialog buildApplyToDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    //Set the dialog title.
    builder.setTitle(R.string.apply_to);
    builder.setCancelable(false);
    builder.setItems(R.array.apply_equalizer_to_array, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            if (which == 0) {
                setEQValuesForSong(mApp.getService().getCurrentSong().getId());
                Toast.makeText(mContext, R.string.eq_applied_to_current_song, Toast.LENGTH_SHORT).show();

                //Finish this activity.
                finish();

            } else if (which == 1) {
                AsyncApplyEQToAllSongsTask task = new AsyncApplyEQToAllSongsTask(mContext, mFragment);
                task.execute();
                dialog.dismiss();

                //Finish this activity.
                finish();

            } else if (which == 2) {
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                EQArtistsListDialog artistDialog = new EQArtistsListDialog();
                artistDialog.show(ft, "eqArtistsListDialog");

                dialog.dismiss();

            } else if (which == 3) {
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                EQAlbumsListDialog albumsDialog = new EQAlbumsListDialog();
                albumsDialog.show(ft, "eqAlbumsListDialog");

                dialog.dismiss();

            } else if (which == 4) {
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                EQGenresListDialog genresDialog = new EQGenresListDialog();
                genresDialog.show(ft, "eqGenresListDialog");

                dialog.dismiss();

            }

        }

    });

    return builder.create();
}

From source file:com.gsma.rcs.ri.sharing.video.OutgoingVideoSharing.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (KeyEvent.KEYCODE_BACK == keyCode) {
        if (LogUtils.isActive) {
            Log.d(LOGTAG, "Back key pressed");
        }/*from   w w w . ja v  a2  s.  co m*/
        try {
            if (mVideoSharing == null || !RcsSessionUtil.isAllowedToAbortVideoSharingSession(mVideoSharing)) {
                finish();
                return true;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(R.string.label_confirm_close);
            builder.setPositiveButton(R.string.label_ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    quitSession();
                }
            });
            builder.setNegativeButton(R.string.label_cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                }
            });
            builder.setCancelable(true);
            registerDialog(builder.show());
            return true;

        } catch (RcsServiceException e) {
            showException(e);
        }
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.hackensack.umc.activity.RegistrationDetailsActivity.java

public void showAlert(Context context, String message, String title, final OuterQuetions outerQuetions) {

    //        new android.app.AlertDialog.Builder(context)
    //                .setTitle(title)
    //                .setMessage(message)
    //                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
    //                    public void onClick(DialogInterface dialog, int which) {
    //                        dialog.dismiss();
    //                        /*Bundle b = new Bundle();
    //                        b.putParcelable(Constant.QUETIONS_DATA, outerQuetions);
    //                        b.putString(Constant.EMAIL_ID, mEmail.getText().toString());
    //                        b.putParcelable(Constant.PATIENT_FOR_EPIC_CALL, cretepationToSendForEpicCall());*/
    ////from   w  w w . java  2  s  .c  o m
    //                        Intent intent = new Intent(RegistrationDetailsActivity.this, QuetionsActivity.class);
    //                        intent.putExtra(Constant.QUETIONS_DATA, outerQuetions);
    //                        if (mInsuranceInfo == null) {
    //                            mInsuranceInfo = new InsuranceInfo();
    //                        }
    //                        intent.putExtra(Constant.INSURANCE_DATA_TO_SEND, new CoverageJsonCreator(mInsuranceInfo.getPlanProvider(), mInsuranceInfo.getMemberNumber(), mInsuranceInfo.getGroupNumber(), mInsuranceInfo.getSubscriberId(), mInsuranceInfo.getReference(), mInsuranceInfo.getSubscriberName(), mInsuranceInfo.getSubscriberDateOfBirth()));
    //                        intent.putExtra(Constant.EMAIL_ID, mEmail.getText().toString());
    //                        intent.putExtra(Constant.PATIENT_FOR_EPIC_CALL, createPationToSendForEpicCall());
    //                        // intent.putExtra("bundle", b);
    //                        startActivity(intent);
    //                    }
    //                })
    //                .setCancelable(false)
    //                .show();

    if (!isFinishing()) {

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(false);
        LayoutInflater inflater = getLayoutInflater();
        View dialogView = inflater.inflate(R.layout.dialog_network_offline, null);
        builder.setView(dialogView);

        ((TextView) dialogView.findViewById(R.id.dialog_title)).setText(title);
        ((TextView) dialogView.findViewById(R.id.text_message)).setText(message);

        Button btnDismiss = (Button) dialogView.findViewById(R.id.button_dialog_ok);
        btnDismiss.setOnClickListener(new Button.OnClickListener() {

            @Override
            public void onClick(View v) {
                alert.dismiss();

                Intent intent = new Intent(RegistrationDetailsActivity.this, QuetionsActivity.class);
                intent.putExtra(Constant.QUETIONS_DATA, outerQuetions);
                if (mInsuranceInfo == null) {
                    mInsuranceInfo = new InsuranceInfo();
                }
                //with nwe json creator.
                intent.putExtra(Constant.INSURANCE_DATA_TO_SEND,
                        new CoverageJsonCreatorNew(mInsuranceInfo.getPlanProvider(),
                                mInsuranceInfo.getMemberNumber(), mInsuranceInfo.getGroupNumber(),
                                mInsuranceInfo.getSubscriberId(), mInsuranceInfo.getReference(),
                                mInsuranceInfo.getSubscriberName(), mInsuranceInfo.getSubscriberDateOfBirth()));
                intent.putExtra(Constant.EMAIL_ID, mEmail.getText().toString());
                intent.putExtra(Constant.PATIENT_FOR_EPIC_CALL, createPationToSendForEpicCall());
                intent.putExtra(Constant.PARENTS_BIRTHDATE, birthDate);
                intent.putExtra(Constant.PARENTS_FIRST_NAME, fName);
                intent.putExtra(Constant.PARENTS_LAST_NAME, lastName);
                intent.putExtra(Constant.PARENTS_GENDER, gender);

                // intent.putExtra("bundle", b);
                startActivity(intent);

            }
        });

        alert = builder.show();
    }

}

From source file:com.mods.grx.settings.GrxSettingsActivity.java

private void show_restore_result(String resultado) {
    sync_preferences();/*from   ww w.  j a  v a2 s .  c  om*/
    AlertDialog.Builder ab = new AlertDialog.Builder(this);
    ab.setTitle(R.string.gs_tit_restaurar);
    ab.setCancelable(false);
    ab.setMessage(resultado);
    ab.setPositiveButton(R.string.gs_si, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    ab.create().show();
}