Example usage for android.app AlertDialog.Builder show

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

Introduction

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

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:net.kourlas.voipms_sms.preferences.DidPreference.java

public void showSelectDidDialog(boolean success, final String[] dids, String message) {
    if (progressDialog != null) {
        progressDialog.hide();/*from w w w  .  j a va  2  s  .co m*/
        progressDialog = null;
    }

    if (success) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), R.style.DialogTheme);
        builder.setTitle(getContext().getString(R.string.preferences_account_did_dialog_title));
        builder.setItems(dids, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Preferences.getInstance(getContext()).setDid(dids[which].replaceAll("[^0-9]", ""));
            }
        });
        builder.show();
    } else {
        Utils.showInfoDialog(getContext(), message);
    }
}

From source file:ch.gianulli.flashcards.SessionFragment.java

private void onSessionFinished() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setMessage(getResources().getString(R.string.session_finished, mAdapter.getCorrectCardsCount(),
            mAdapter.getCount()));/*  www  .  j a va 2 s.c o m*/
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            getActivity().finish();
        }
    });
    builder.show();
}

From source file:at.maui.cheapcast.fragment.DonationsFragment.java

/**
 * Open dialog/*ww  w. j  a v a2s .c  o m*/
 *
 * @param icon
 * @param title
 * @param message
 */
void openDialog(int icon, int title, String message) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());
    dialog.setIcon(icon);
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setCancelable(true);
    dialog.setNeutralButton(R.string.donations__button_close, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.ifraag.facebookclient.FacebookClient.java

public void getUserProfileInformation() {

    /* This must be added in case login is required after logout because when session is closed, it cannot be re-opened.*/
    activateSession();//from   ww  w . j  a v a2 s  .com

    /*Make an API call to get user data and define a new callback to handle the response. */
    Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
        @Override
        public void onCompleted(GraphUser user, Response response) {

            /*If the response is successful and user information is not null, get the user name and profile picture then update your Settings Views.*/
            if (session == Session.getActiveSession()) {
                if (user != null) {
                    /* Get user name*/
                    name = user.getName();
                    Log.i(FB_CLIENT_TAG, " Current name is " + name);
                    Toast.makeText(currentContext, name + " has logged to Facebook", Toast.LENGTH_SHORT).show();
                    //Log.i(FB_CLIENT_TAG, " Current Username is " + user.getUsername());

                    /* Get user profile picture. */
                    new ProfilePic().execute(user.getId());

                    /* Update your views with the obtained user's name and profile picture. */
                    facebookView.updateLayoutViews();
                }
            }
            if (response.getError() != null) {
                /*TODO: Handle two different errors; first one is for Connection Error while second one is session closure.
                 * Please check what is returned from response.getError()*/
                Log.i(FB_CLIENT_TAG, " an error occurred while getting Facebook API response");
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(currentContext)
                        .setTitle("Connection Error").setMessage("Turn on WiFi or Data Connection");

                alertDialog.show();
            }
        } /*onCompleted*/
    }/* anonymous class */);

    /* Execute your requests asynchronously (with request.executeAsync()) to avoid running your requests in the UI Thread.
    This improves performance and ensures compatibility with Android 3.0+ */
    request.executeAsync();
}

From source file:com.ts.mobilelab.goggles4u.PrescriptionAddActivity.java

public static void show_dialog(Context cxt, String msg) {

    final AlertDialog.Builder alert = new AlertDialog.Builder(cxt);
    alert.setMessage(msg);/*from  w  ww.j  a  va2  s. co m*/
    alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();

        }
    });
    alert.show();

}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment32.java

private void failDialog() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle(" ? ");
    alertDialog.setMessage("? ?? ");
    alertDialog.setIcon(R.drawable.fail);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();//from   www .  j av  a 2s  .c  o m
        }
    });

    alertDialog.show();
}

From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java

public void getTextInputForAction(String title, String hintText, String doButtonText, String dontButtonText,
        final RunnableWithResults<String> callback) {

    final EditText textView = new EditText(activity);
    textView.setHint(hintText);//from   ww w .j a v a2  s  .c o m

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setView(textView);
    builder.setTitle(title);
    builder.setCancelable(false).setPositiveButton(doButtonText, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            callback.callback(textView.getText().toString());
        }
    }).setNegativeButton(dontButtonText, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
        }
    });
    builder.show();

}

From source file:de.tudresden.inf.rn.mobilis.groups.overlays.GroupsOverlay.java

@Override
protected boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    GroupItemInfo gii = groupItemInfos.get(index);

    LayoutInflater inflater = (LayoutInflater) mainActivity
            .getSystemService(mainActivity.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.groups_details_dialog,
            (ViewGroup) mainActivity.findViewById(R.id.groups_details_layout_root));

    TextView text = (TextView) layout.findViewById(R.id.groups_details_text);
    text.setText(Html.fromHtml("<b>Latitude:</b> " + gii.latitudeE6 / 1E6 + "<br><b>Longitude:</b> "
            + gii.longitudeE6 / 1E6 + "<br><b>Number of Members:</b> " + gii.memberCount));

    //Prepare the Intent for creating a group at this foursquare venue
    final Intent i = new Intent(mainActivity.getApplicationContext(), GroupInfoActivity.class);
    i.putExtra("group_id", gii.groupId);

    String title = gii.name;//w w w. j av  a2s .  c  o  m
    if (title == null || title.equals(""))
        title = " ";
    AlertDialog.Builder builder = new AlertDialog.Builder(mainActivity);
    builder.setTitle(title).setView(layout).setIcon(R.drawable.group_marker_24).setCancelable(true)
            .setPositiveButton("Details", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    mainActivity.startActivity(i);
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    builder.show();
    return true;
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment32.java

private void limitDialog() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle(" ? ");
    alertDialog.setMessage(" ?  ? 6");
    alertDialog.setIcon(R.drawable.fail);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();/*  w w  w  .j a v  a  2  s .c  o m*/
        }
    });

    alertDialog.show();
}

From source file:com.khoahuy.phototag.HomeActivity.java

@Override
protected void processNfcID() {
    if (("").equals(nfcid) || nfcid == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(HomeActivity.this);
        builder.setTitle("Error");
        builder.setMessage("Dected your tag fail");
        builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
            }/*from   w w  w. jav a2  s.  c o  m*/
        });
        builder.show();
    } else if (existedUID(nfcid)) {
        displayNFCItem(nfcid);
    } else {
        dispatchTakePictureIntent(ACTION_TAKE_PHOTO_B);
    }
}