Example usage for android.app AlertDialog setMessage

List of usage examples for android.app AlertDialog setMessage

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:org.epstudios.epcoding.ScreenSlideActivity.java

protected void displayResult(String title, String message, Context context) {
    AlertDialog dialog = new AlertDialog.Builder(context).create();
    dialog.setMessage(message);
    dialog.setButton(DialogInterface.BUTTON_POSITIVE, "Exit Wizard", new DialogInterface.OnClickListener() {
        @Override//w w  w .j a va 2  s.  c o m
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    dialog.setButton(DialogInterface.BUTTON_NEUTRAL, "Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // just close dialog
        }
    });
    dialog.setTitle(title);
    dialog.show();
}

From source file:pt.hive.cameo.activities.LoginActivity.java

public void handleException(JSONObject data) {
    try {/*from   w w w . j av  a  2s . c  o  m*/
        JSONObject exception = data.getJSONObject("exception");
        String message = exception.getString("message");
        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle("Error in submission");
        alertDialog.setMessage(message);
        alertDialog.show();
    } catch (JSONException exception) {
        throw new RuntimeException(exception);
    }
}

From source file:com.toppatch.mv.ui.activities.MainActivity.java

private void checkConditions() {
    //sendToWelcomePage();
    if (isConnectingToInternet()) {
        if (AdminHelper.isUserLoggedIn(this)) {
            if (AdminHelper.isAdminActive(this)) {
                if (AdminHelper.isSamsungESDKEnabled(this))
                    if (AdminHelper.isGCMRegistered(this)) {
                        Log.i("see", "gcmif");
                        sendToWelcomePage();
                    } else {
                        Log.i("see", "gcmelse");
                        sendToGCMPage();
                    }/*from  w  ww. j a v a 2s. c  om*/
                else {
                    Log.i("see", "register");
                    Boolean canRegiser = Registration.register(this);
                    if (!canRegiser)
                        sendToLoginPage();
                }

            } else {
                sendToLoginPage();
            }
        } else {
            sendToLoginPage();
        }
    } else {
        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle("Ohh No!!");
        alertDialog.setMessage("No Internet Connection...Exiting..");
        alertDialog.show();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
            }
        }, 2000);
    }
}

From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java

private void promptTTSInstall() {
    AlertDialog ttsInstallDlg = new AlertDialog.Builder(this).create();
    ttsInstallDlg.setMessage(getString(R.string.tts_install_msg));
    ttsInstallDlg.setTitle(getString(R.string.tts_install_title));

    ttsInstallDlg.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.proceed_str),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();/*from  w w  w . j a v a2  s  . c om*/
                    Intent installIntent = new Intent();
                    installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                    startActivity(installIntent);
                }
            });

    ttsInstallDlg.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel_str),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                    finish();
                }
            });
}

From source file:ch.fixme.status.Widget_config.java

@Override
protected Dialog onCreateDialog(int id) {
    AlertDialog dialog = null;
    switch (id) {
    case DIALOG_LOADING:
        dialog = new ProgressDialog(this);
        dialog.setCancelable(false);/*from ww  w  . j  a  v a  2 s  . c  o m*/
        dialog.setMessage(getString(R.string.msg_loading));
        dialog.setCancelable(true);
        ((ProgressDialog) dialog).setIndeterminate(true);
        break;
    }
    return dialog;
}

From source file:com.aikidonord.Intervenant.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_intervenant);

    View rlLoading = findViewById(R.id.loadingPanel);
    View listView = findViewById(R.id.list);

    ActionBar actionBar = this.getSupportActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(getResources().getString(R.string.actionbar_titre_intervenant));

    if (VerifConnexion.isOnline(this)) {

        rlLoading.setVisibility(View.VISIBLE);
        listView.setVisibility(View.GONE);

        new QueryForAnimateurTask().execute(this, this.getApplicationContext());
    } else {/*  w w w  .  j ava2s .c  om*/

        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        Intervenant.this.finish();
                    }
                });
        alertDialog.show();
    }

}

From source file:es.uja.photofirma.android.SignUpActivity.java

/**
 * Advertencia a cerca de la privacidad del usuario, el usuario ser notificado
 * /*from   ww  w  .  j a va2 s.c o m*/
 */
public void onTermsOfUse(View view) {
    final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Terminos de uso");
    alertDialog.setMessage(getString(R.string.terms_of_use));
    alertDialog.setCancelable(false);
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
        }
    });
    alertDialog.show();

}

From source file:org.odk.collect.android.activities.FormChooserList.java

/**
 * Creates a dialog with the given message. Will exit the activity when the user preses "ok" if
 * shouldExit is set to true.//ww w.  j a v  a  2s. com
 */
private void createErrorDialog(String errorMsg, final boolean shouldExit) {

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setIcon(android.R.drawable.ic_dialog_info);
    alertDialog.setMessage(errorMsg);
    DialogInterface.OnClickListener errorListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int i) {
            switch (i) {
            case DialogInterface.BUTTON_POSITIVE:
                if (shouldExit) {
                    finish();
                }
                break;
            }
        }
    };
    alertDialog.setCancelable(false);
    alertDialog.setButton(getString(R.string.ok), errorListener);
    alertDialog.show();
}

From source file:org.openremote.android.console.view.PanelSelectSpinnerView.java

@Override
public void urlConnectionDidReceiveResponse(HttpResponse httpResponse) {
    int statusCode = httpResponse.getStatusLine().getStatusCode();
    if (statusCode != Constants.HTTP_SUCCESS) {
        if (statusCode == ControllerException.UNAUTHORIZED) {
            LoginDialog loginDialog = new LoginDialog(getContext());
            loginDialog.setOnClickListener(loginDialog.new OnloginClickListener() {
                @Override//from   w w w . j av a2s.c o m
                public void onClick(View v) {
                    super.onClick(v);
                    requestPanelList(getContext(), PanelSelectSpinnerView.this);
                }

            });
        } else {
            // The following code customizes the dialog, because the finish method should do after dialog show and click ok.
            AlertDialog alertDialog = new AlertDialog.Builder(getContext()).create();
            alertDialog.setTitle("Panel List Not Found");
            alertDialog.setMessage(ControllerException.exceptionMessageOfCode(statusCode));
            alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    return;
                }
            });
            alertDialog.show();
            setDefaultAdapterContent();
        }
    }
}

From source file:net.networksaremadeofstring.cyllell.Search.java

public void MakeHandler() {
    handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                //TODO ListView population
                NodeAdapter = new NodeListAdaptor(Search.this, listOfNodes);
                list.setAdapter(NodeAdapter);

                //Close the Progress dialog
                dialog.dismiss();//from   w ww  .ja  v a 2 s  .c  om
            } else if (msg.what == 200) {
                dialog.setMessage("Searching for: " + query + "\n\nSending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(Search.this).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("Back", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        Search.this.finish();
                    }
                });
                alertDialog.setIcon(R.drawable.error);
                alertDialog.show();
            }

        }
    };
}