Example usage for android.app AlertDialog.Builder setMessage

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

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:au.com.wallaceit.reddinator.ViewRedditActivity.java

public void showShareDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(ViewRedditActivity.this);
    builder.setMessage("Share Url").setNegativeButton("Content", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            shareText(getIntent().getStringExtra(WidgetProvider.ITEM_URL));
        }/* w  ww .j  a  v  a  2 s.c o m*/
    }).setPositiveButton("Reddit Page", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            shareText("http://reddit.com" + getIntent().getStringExtra(WidgetProvider.ITEM_PERMALINK));
        }
    });
    // Create the AlertDialog
    builder.create().show();
}

From source file:com.mikecorrigan.trainscorekeeper.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Log.vc(VERBOSE, TAG, "onOptionsItemSelected: item=" + item);

    switch (item.getItemId()) {
    case R.id.new_game:
        final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
        builder.setMessage(R.string.new_game_prompt).setPositiveButton(R.string.yes, onNewGameConfirmDialog)
                .setNegativeButton(R.string.no, onNewGameConfirmDialog).show();
        return true;
    case R.id.undo:
        undo();// w  ww  . j  a  v a 2  s  .co  m
        return true;
    case R.id.redo:
        redo();
        return true;
    case R.id.preferences:
        preferences();
        return true;
    case R.id.help:
        help();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.myandroidremote.AccountsActivity.java

/**
 * Sets up the 'connect' screen content.
 *//*w w w .  jav  a  2s .c  o m*/
private void setConnectScreenContent() {
    List<String> accounts = getGoogleAccounts();
    if (accounts.size() == 0) {
        // Show a dialog and invoke the "Add Account" activity if requested
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(R.string.needs_account);
        builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
            }
        });
        builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                showLoadingScreen();
            }
        });
        builder.setIcon(android.R.drawable.stat_sys_warning);
        builder.setTitle(R.string.attention);
        builder.show();
    } else {
        final ListView listView = (ListView) findViewById(R.id.select_account);
        listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts));
        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView.setItemChecked(mAccountSelectedPosition, true);

        final Button connectButton = (Button) findViewById(R.id.connect);
        connectButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // Register in the background and terminate the activity
                mAccountSelectedPosition = listView.getCheckedItemPosition();
                TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition);
                register((String) account.getText());

                // show connecting
                showLoadingScreen();
            }
        });

        final Button exitButton = (Button) findViewById(R.id.exit);
        exitButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                finish();
            }
        });
    }
}

From source file:ota.otaupdates.MainActivity.java

private void allow_write_sd() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.write_access));
    builder.setMessage(getString(R.string.write_access_message));
    builder.setPositiveButton(getString(R.string.button_ok), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            if (Build.VERSION.SDK_INT >= 23 && !checkPermission()) {
                // If user hasn't allowed yet, request the permission.
                requestPermission();/*from  ww  w .  j  a v a2  s  . c om*/
            }
        }
    });
    AlertDialog alert = builder.create();
    alert.setCancelable(false);
    if (!checkPermission()) {
        // If user hasn't allowed yet, show requester dialog.
        alert.show();
    }
}

From source file:com.mhise.util.MHISEUtil.java

public static Dialog displayDialog(Context ctx, String message, String title) {

    AlertDialog.Builder alertDialogBuilder = null;
    try {/*from  w w w  . j  ava2s .c  o m*/
        if (!message.equals("") || !message.equals(null)) {

            alertDialogBuilder = new AlertDialog.Builder(ctx);

            alertDialogBuilder.setMessage(message);
            //alertDialogBuilder.setTitle(title);
            alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {

                }
            });
            // Showing Alert Message
            alertDialogBuilder.show();

        }
    } catch (NullPointerException e) {
        // TODO: handle exception

        Logger.debug("MHISEUtil-->Unable to display dialog message", "display dialog");

    }
    return alertDialogBuilder.create();
}

From source file:com.njlabs.amrita.aid.aums.AumsActivity.java

@Override
public void init(Bundle savedInstanceState) {
    setupLayout(R.layout.activity_aums, Color.parseColor("#e91e63"));

    rollNoEditText = (EditText) findViewById(R.id.roll_no);
    passwordEditText = (EditText) findViewById(R.id.pwd);

    List<String> campusDataSet = new LinkedList<>(Arrays.asList("Ettimadai", "Amritapuri", "Bangalore",
            "Mysore", "AIMS", "Business schools", "ASAS Kochi"));

    spinner = (MaterialSpinner) findViewById(R.id.spinner);
    spinner.setItems(campusDataSet);//from www .j ava2s . c om

    AlertDialog.Builder builder = new AlertDialog.Builder(baseContext);
    builder.setMessage("Amrita University does not provide an API for accessing AUMS data. "
            + "So, if any changes are made to the AUMS Website, please be patient while I try to catch up.")
            .setCancelable(true).setIcon(R.drawable.ic_action_info_small)
            .setPositiveButton("Got it !", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                    hideSoftKeyboard();
                }
            });

    AlertDialog alert = builder.create();
    alert.requestWindowFeature(Window.FEATURE_NO_TITLE);
    alert.show();

    dialog = new ProgressDialog(baseContext);
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.setInverseBackgroundForced(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setMessage("Authenticating your credentials ... ");

    aumsPreferences = getSharedPreferences("aums_prefs", Context.MODE_PRIVATE);
    String rollNo = aumsPreferences.getString("RollNo", "");
    String encodedPassword = aumsPreferences.getString("Password", "");
    spinner.setSelectedIndex(aumsPreferences.getInt("server_ordinal", 0));

    aums = new Aums(baseContext);

    if (!rollNo.equals("")) {
        ((EditText) findViewById(R.id.roll_no)).setText(rollNo);
        aums.studentRollNo = rollNo;
        hideSoftKeyboard();
    }

    if (!encodedPassword.equals("")) {
        ((EditText) findViewById(R.id.pwd)).setText(Security.decrypt(encodedPassword, MainApplication.key));
        hideSoftKeyboard();
    }

}

From source file:com.github.barcodeeye.scan.CaptureActivity.java

/**
 * FIXME: This should be a glass compatible view (Card)
 *///from  w w w  .  j a v a  2 s .co m
private void displayFrameworkBugMessageAndExit() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.app_name));
    builder.setMessage(getString(R.string.msg_camera_framework_bug));
    builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
    builder.setOnCancelListener(new FinishListener(this));
    builder.show();
}

From source file:com.zen.bodybuildingdiet.IntroScreen.java

public void showWaiver(String result) {

    AlertDialog.Builder builder = new AlertDialog.Builder(IntroScreen.this);
    builder.setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();//from   w ww  .j a v a 2  s .c  o m
        }
    });
    builder.setMessage("End User License Agreement" + "\n" + "\n"
            + "IF YOU DOWNLOAD THE SOFTWARE SUBJECT TO THESE TERMS BY CLICKING THE I AGREE BUTTON, AND/OR USE THE Zen Software, LLC SOFTWARE OR/AND INCLUDED DOCUMENTATION (together the \"Software\"), YOU AGREE TO BE BOUND BY THE TERMS AND CONDITIONS OF THIS AGREEMENT (the \"Agreement\"), AND THIS WILL BE A LEGALLY BINDING AGREEMENT BETWEEN YOU AND ZEN SOFTWARE, LLC (\"Zen Software, LLC\").  PLEASE READ THIS DOCUMENT CAREFULLY BEFORE ACCEPTING THESE TERMS AND USING THIS SOFTWARE.    IF YOU DO NOT AGREE WITH THE TERMS AND CONDITIONS OF THIS AGREEMENT, YOU SHOULD REJECT THEM BY NOT DOWNLOADING THE SOFTWARE.  References in this Agreement to \"you\" or \"your\" refer to both you and any person or entity on whose behalf you act, if any."
            + "\n" + "\n"
            + "1.  Grant Of License.  Subject to the terms and conditions of this Agreement, Zen Software, LLC hereby grants to you a personal, non-transferable and non-exclusive license to install and use the Software on your device for the purposes of your own diet and exercise needs."
            + "\n" + "\n"
            + "2.  Software Use Restrictions.  You shall not sublicense, distribute, hypothecate, lease, loan or otherwise convey the Software or any portion thereof to anyone, and under no circumstance may you use or allow the use of the Software in any manner other than as expressly set forth above.  You shall not modify the Software, incorporate the Software in whole or in part in any other product or create derivative works based on all or part of the Software.  You shall not remove any copyright, trademark, proprietary rights, disclaimer or warning notice included on or embedded in any part of the Software.  You shall not use the Software in connection with a service bureau, time sharing or fee-for service arrangement with third parties.  Except to the extent permitted by applicable local law, you shall not reverse assemble, decompile or disassemble or otherwise reverse engineer any portion of the Software.  If you dispose of any media embodying Software, you will ensure that you have completely erased or otherwise destroyed any Software stored on such media.  THE SOFTWARE IS NOT INTENDED FOR USE IN ANY SITUATION IN WHICH THE FAILURE OF THE SOFTWARE COULD LEAD TO DEATH OR BODILY INJURY OF ANY TYPE."
            + "\n" + "\n"
            + "3.  Copying Restrictions.  You may copy the Software onto your device, and you may make one (1) copy of the Software for backup or archival purposes.  You agree that (i) your use and possession of such copies shall be solely under the terms and conditions of this Agreement, and (ii) you shall place the same proprietary and copyright notices and legends on all such copies as included by Zen Software, LLC on any media embodying an authorized copy of the Software originally provided by Zen Software, LLC.  Except as described in this paragraph, you are not permitted to copy the Software."
            + "\n" + "\n"
            + "4.  Disclosure Restrictions.  You acknowledge that the Software, including the source code for the Software and any information derived therefrom, constitutes a valuable trade secret of Zen Software, LLC.  You shall not disclose such materials to anyone."
            + "\n" + "\n"
            + "5.  Ownership of Software.  You agree and acknowledge that (i) the Software is licensed to you, not sold, and Zen Software, LLC transfers no ownership interest in the Software, in the intellectual property in any Software or in any Software copy, to you under this Agreement or otherwise, (ii) that Zen Software, LLC and its licensors reserve all rights not expressly granted to you hereunder, (iii) Zen Software, LLC or its licensors own the Software (including, but not by way of limitation, any images, algorithms, photographs, animations, video, audio, music and text incorporated in the Software), and (iv) the Software is protected by United States Copyright Law and international treaties relating to protection of copyright.  The Software includes, and this Agreement will cover, any updates, upgrades or bug fixes for the Software provided to you."
            + "\n" + "\n"
            + "6.  Transfer Restrictions.  You may transfer the Software and all licenses and rights in the Software granted to you under this Agreement to a third party provided that: (i) such transferee agrees to accept the terms and conditions of this Agreement, and (ii) you also transfer all Software, including all copies thereof, to such transferee.  Except as provided in this Section, you may not transfer or assign this Agreement or any of your rights or obligations under this Agreement, in whole or in part."
            + "\n" + "\n"
            + "7.  Export Restrictions.  You may not export or re-export any Software except in full compliance with all United States laws and regulations, executive orders and the like, including in particular the Export Administration Regulations of the U.S.  Department of Commerce.  Without limitation of the foregoing, no Software may be exported or re-exported into (or to a national or resident of) any country to which the U.S. embargoes goods, or to anyone on the U.S.  Treasury Departments list of Specially Designated Nationals and Blocked Persons or the U.S.  Commerce Departments Denied Persons List."
            + "\n" + "\n"
            + "8.  Enforcement Of Terms; Termination.  If you fail to fulfill any of your obligations under this Agreement, this Agreement, this Agreement will automatically terminate, and Zen Software, LLC and/or its licensors may pursue all available legal remedies available to them.  You agree that Zen Software, LLCs licensors referenced in the Software are third-party beneficiaries of this Agreement, and may enforce this Agreement as it relates to their intellectual property.  Sections 2-9 and 11-18 shall survive any termination or expiration of this Agreement."
            + "\n" + "\n"
            + "9.  U.  S.  Government Users.  Pursuant to the policy stated at48 CFR 227.7202-1, U.S.  Government users acknowledge that (i) the Software is commercial computer software, (ii) this Agreement embodies the licenses customarily used by Zen Software, LLC for licenses in Software granted to the public, and (iii) the licenses set forth herein shall apply to all possession, use and duplication of the Software by the Government, except to the extent which such licenses are inconsistent with Federal procurement law.  Contractor/manufacturer is Zen Software, LLC, Inc."
            + "\n" + "\n"
            + "10.  Assumption of Risk.  You acknowledge that your diet and exercise activities involve risks, which may involve risk of bodily injury or death, and that you assume those risks.  You should consult a licensed physician prior to beginning or modifying any diet or exercise program that you undertake, and you acknowledge that Zen Software, LLC has advised you of the necessity for obtaining such consultations.  In addition, the Software should not be used by pregnant women or individuals underage 18.  The Software is a source of information, but it does not provide medical advice.  In no event shall Zen Software, LLC be liable for any death or bodily injury that you suffer, or that you cause to any third party, in connection with your use of the Software or any diet, exercise or other activity you undertake in connection with your use of the Software."
            + "\n" + "\n"
            + "11.  Disclaimer of Warranty.  ZEN SOFTWARE, LLC PROVIDES THE SOFTWARE TO YOU \"AS IS\", WITH ALL FAULTS, AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, STATUTORY, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION ANV WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  ZEN SOFTWARE, LLC MAKES NO REPRESENTATION OR WARRANTY THAT THE SOFTWARE IS ACCURATE, COMPLETE OR UP-TO-DATE.  NO ORAL ORWRITTEN INFORMATION OR ADVICE GIVEN BY ANY ZEN SOFTWARE, LLC EMPLOVEE, REPRESENTATIVE OR DISTRIBUTOR SHALL CREATE A WARRANTY FOR THE SOFTWARE, AND YOU MAY NOT RELY ON ANY SUCH INFORMATION OR ADVICE.  ZEN SOFTWARE, LLCS LICENSORS EXPLICITLY DISCLAIM ANY AND ALL WARRANTIES WITH RESPECT TO THE SOFTWARE."
            + "\n" + "\n"
            + "12.  Limitation Of Liability.  IN NO EVENT SHALL ZEN SOFTWARE, LLC OR ITS LICENSORS BE LIABLE TO YOU FOR ANY SPECIAL, CONSEOUENTIAL, PUNITIVE, EXEMPLARY, INCIDENTAL OR INDIRECT DAMAGES OFANY KIND (INCLUDING WITHOUT LIMITATION THE COST OF COVER, DAMAGES ARISING FROM LOSS OF DATA, USE, PROFITS OR GOODWILL), WHETHER OR NOT ZEN SOFTWARE, LLC HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITV ARISING OUT OF THIS AGREEMENT.  THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OFANV LIMITED REMEDY.  ZEN SOFTWARE, LLCS MAXIMUM AGGREGATE LIABILITY ARISING OUT OF THIS AGREEMENT AND/OR YOURR USE OR POSSESSION OFTHE SOFTWARE, INCLUDING WITHOUT LIMITATION ANY CLAIMS IN TORT (INCLUDING NEGLIGENCE), CONTRACT, BREACH OF WARRANTY, STRICT LIABILITY OR OTHERWISE, AND FOR ANY AND ALL CLAIMS COMBINED, WILL NOT EXCEED THE LESSER OF(A) $10; OR(B) THE FEE YOU PAID FOR YOUR LICENSE TO THE SOFTWARE."
            + "\n" + "\n"
            + "13.  Governing Law.  This Agreement shall be governed by and interpreted in accordance with the laws of the Commonwealth of Minnesota, excluding its choice of law rules.  The United Nations Convention on Contracts for the International Sale of Goods shall not apply."
            + "\n" + "\n"
            + "14.  Disputes.  A party shall not seek relief from a court with respect to any dispute arising in connection with this Agreement (except for any application for urgent equitable relief) unless such dispute has first been referred to voluntary mediation, and, if such mediation is not successful, has been submitted to arbitration conducted by a panel of three arbitrators sitting in Minneapolis, Minnesota.  Each party shall choose one arbitrator and those two shall choose the third.  The arbitration shall be conducted in accordance with the Commercial Arbitration Rules of the American Arbitration Association and the decision of the arbitrators shall be binding and enforceable in any court of competent jurisdiction.  The arbitrators shall have no power to award punitive damages nor any damages inconsistent with this Agreement or measured other than by the actual losses suffered by the parties."
            + "\n" + "\n"
            + "15.  Complete Agreement; Waiver; Severability.  This Agreement supersedes all proposals, oral or written, all negotiations, conversations, discussions and all past course of dealing between you and  Zen Software, LLC relating to the Software or the terms of its license to you, and may only be modified in writing signed by you and Zen Software, LLC.  In the event any term of this Agreement is held by a court of competent jurisdiction not to be enforceable, the remaining terms shall survive and be enforced to the maximum extent permissible by law.  No waiver of any right or obligation contained herein shall be given except in writing signed by the party against whom the waiver is sought to be enforced.  If any of the provisions of this Agreement are held to be invalid under any applicable statute or rule of law, they shall be severed from this Agreement and the remaining provisions of this Agreement shall be interpreted so as best to reasonably effect the intent of the parties.  The parties further agree to replace any such invalid or unenforceable provisions with valid and enforceable provisions designed to achieve, to the extent possible, the business purposes and intent of such invalid or unenforceable provisions."
            + "\n" + "\n"
            + "16.  Consent to Electronic Contracting.  You agree that execution of this Agreement may occur by your manifesting your acceptance of it when you downloaded the Software, and that no signature on a paper copy of this Agreement is required in order to form a binding contract."
            + "\n" + "\n"
            + "17.  Privacy Disclosure.  Zen Software, LLC may use analytics technology to track anonymous traffic data about the use of the Software.  This data does not include any personally identifiable information of you, the user.  Some of the analytics technology described in this paragraph is provided to Zen Software, LLC by Google, Inc. (\"Google\").  Under the Google Analytics Terms of Service, Google and its subsidiaries have the right to retain and use the anonymous traffic data collected by the Google Analytics service from users of the Software.  Google's use of such data is subject to the Google Privacy Policy located at http://www.google.com/privacy.html.");

    AlertDialog alert = builder.create();
    alert.setCancelable(false);
    alert.show();
}

From source file:com.photon.phresco.nativeapp.eshop.activity.PhrescoActivity.java

/**
 * Show the error message dialog box with OK button
 *
 * @param errorMessage/*from w  w w .  jav  a  2s  .  c  o m*/
 */
private void showErrorDialog(String errorMessage) {
    try {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(errorMessage).setTitle(R.string.app_name).setCancelable(false)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        finish();
                        // System.runFinalizersOnExit(true);
                        android.os.Process.killProcess(android.os.Process.myPid());
                    }
                });
        @SuppressWarnings("unused")
        AlertDialog alert = builder.show();
    } catch (Exception ex) {
        PhrescoLogger.info(TAG + "showErrorDialog: " + ex.toString());
        PhrescoLogger.warning(ex);
    }
}