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:bizapps.com.healthforusPatient.activity.RegisterActivity.java

public void showErrorDialog(String msg, final boolean isVerify) {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

    // set title//from w w  w.ja va 2s.c o m
    alertDialogBuilder.setTitle("Info");

    // set dialog message
    alertDialogBuilder.setMessage(msg).setCancelable(false).setNegativeButton("Okay",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                    if (status.equalsIgnoreCase("success") && isVerify) {
                        verifyAccount();
                    } else {
                        Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
                        startActivity(intent);
                        finish();
                    }
                }
            });

    AlertDialog alertDialog = alertDialogBuilder.create();

    alertDialog.show();

}

From source file:com.googlecode.CallerLookup.Main.java

public void doHelp() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(R.string.HelpTitle);/*from www . j a va2s  .com*/
    alert.setMessage(R.string.HelpMessage);
    alert.setPositiveButton(android.R.string.ok, null);
    alert.show();
}

From source file:com.cleverzone.zhizhi.capture.CaptureActivity.java

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  ww w  .j  av  a  2 s .  co  m*/
}

From source file:com.nbplus.hybrid.BasicWebViewClient.java

@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
    mPageLoadSuccess = false;/*from   w ww  .jav  a2  s .co  m*/
    Log.e(TAG, "WebView client onReceivedError code = " + errorCode);
    switch (errorCode) {
    case ERROR_AUTHENTICATION: // ? ? ?? 
    case ERROR_BAD_URL: // ? URL
    case ERROR_CONNECT: //   
    case ERROR_FAILED_SSL_HANDSHAKE: // SSL handshake  
    case ERROR_FILE: // ? ? 
    case ERROR_FILE_NOT_FOUND: // ?? ?  
    case ERROR_HOST_LOOKUP: //  ? ?  ?  
    case ERROR_IO: // ? ?   
    case ERROR_PROXY_AUTHENTICATION: // ?? ? ?? 
    case ERROR_REDIRECT_LOOP: //  ? 
    case ERROR_TIMEOUT: //   
    case ERROR_TOO_MANY_REQUESTS: // ?   ?  ?
    case ERROR_UNKNOWN: // ? 
    case ERROR_UNSUPPORTED_AUTH_SCHEME: // ??  ?? 
    case ERROR_UNSUPPORTED_SCHEME:
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setPositiveButton("?", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                closeWebApplication();
            }
        });
        builder.setMessage(R.string.webview_page_loading_error);
        builder.show();

        dismissProgressDialog();
        // Default behaviour
        super.onReceivedError(view, errorCode, description, failingUrl);
    }
}

From source file:net.evecom.android.log.DailyLogLookActivity.java

/**
 * //from   ww  w .  jav  a  2s . c  o m
 */
private String submit() {
    /**  */
    if (btEditText.getText().toString().trim().length() < 1) {
        DialogToast("");
        return "";
    } else if (gzsjButton.getText().toString().trim().length() < 1) {
        DialogToast("");
        return "";
    } else if (rzlxButton.getText().toString().trim().length() < 1) {
        DialogToast("");
        return "";
    } else if (rznrEditText.getText().toString().trim().length() < 1) {
        DialogToast("");
        return "";
    } else if (years > calendar.get(Calendar.YEAR)) {
        DialogToast("");
        return "";
    } else if (years == calendar.get(Calendar.YEAR)) {
        if (month > calendar.get(Calendar.MONTH) + 1) {
            DialogToast("");
            return "";
        } else if (month == calendar.get(Calendar.MONTH) + 1) {
            if (day > calendar.get(Calendar.DAY_OF_MONTH)) {
                DialogToast("");
                return "";
            }
        }
    }
    final AlertDialog.Builder builder = new AlertDialog.Builder(DailyLogLookActivity.this);
    builder.setTitle("");
    builder.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder.setMessage("");
    builder.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            progressDialog = ProgressDialog.show(DailyLogLookActivity.this, "", "...");

            formSubmit();

        }
    });
    builder.setNegativeButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.show();
    return "1";
}

From source file:gr.scify.newsum.ui.SearchViewActivity.java

private void Copy() {
    //      TextView tx = (TextView) findViewById(R.id.textView1);
    TextView title = (TextView) findViewById(R.id.title);
    String sdtitle = title.getText().toString();
    //      String copytext = tx.getText().toString();
    String alphaAndDigits = sdtitle.replaceAll("[^\\p{L}\\p{N}]", " ");
    Boolean isSDPresent = android.os.Environment.getExternalStorageState()
            .equals(android.os.Environment.MEDIA_MOUNTED);

    // track the copy to SD button
    if (getAnalyticsPref()) {
        EasyTracker.getTracker().sendEvent(SHARING_ACTION, "Save to SD", alphaAndDigits, 0l);
    }/*from  ww w  . j ava  2  s.  com*/
    if (isSDPresent) {
        File folder = new File(Environment.getExternalStorageDirectory() + "/NewSum");
        boolean success = false;
        if (!folder.exists()) {
            success = folder.mkdir();
        }
        if (!success) {
            // Do something on success
        } else {
            // Do something else on failure
        }
        File logFile = new File(folder, alphaAndDigits + ".txt");
        // File logFile = new
        // File(Environment.getExternalStorageDirectory().toString(),
        // alphaAndDigits+".txt");
        if (!logFile.exists()) {
            try {
                logFile.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        BufferedWriter output = null;
        try {
            output = new BufferedWriter(new FileWriter(logFile));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            output.write(pText);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {

            output.close();
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(R.string.save_massage);
            builder.setMessage(logFile.getPath());
            builder.setPositiveButton(getResources().getText(R.string.ok).toString(),
                    new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });
            AlertDialog a = builder.create();
            a.show();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        Toast.makeText(SearchViewActivity.this, R.string.check_sd, Toast.LENGTH_SHORT).show();
    }

}

From source file:com.googlecode.CallerLookup.Main.java

public void doRemove() {
    final Context context = this;
    final String name = mLookup.getSelectedItem().toString();

    AlertDialog.Builder confirm = new AlertDialog.Builder(context);
    confirm.setTitle(R.string.RemoveTitle);
    confirm.setMessage(R.string.RemoveMessage);
    confirm.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
        @SuppressWarnings("unchecked")
        @Override//  w  w  w.j a  v  a  2s . com
        public void onClick(DialogInterface dialog, int which) {
            removeUserLookupEntry(name);
            doCustomize();

            ArrayAdapter<CharSequence> adapter = (ArrayAdapter<CharSequence>) mLookup.getAdapter();
            adapter.remove(name);
        }
    });
    confirm.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    confirm.show();
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.id_btn_avail_next_7:
        Calendar cal = Calendar.getInstance();
        cal.set(cal.get(Calendar.YEAR), Integer.parseInt(mMonth), Integer.parseInt(mDay));
        cal.add(Calendar.DAY_OF_MONTH, 6);
        mDay = String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
        mMonth = String.valueOf(cal.get(Calendar.MONTH));
        mDetails = null;/*from  w w w  .j a v a  2s. co m*/
        mFrameLayout = null;
        mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
        new GetAvail().execute();
        mDialog.setMessage("Fetching train availability . . .");
        mDialog.show();
        break;
    default:
        final TextView tv = (TextView) ((TableRow) v).getChildAt(1);
        if (tv.getText().toString().contains("Date")) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(TrainDetails.this);
        builder.setTitle("Book ticket");
        builder.setMessage(
                "You will be taken directly to IRCTC travel planner with all the information filled in it. Are you sure?");
        builder.setPositiveButton("Yes, Book ticket", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                String day = tv.getText().toString().split("-", 0)[0].trim();
                String month = tv.getText().toString().split("-", 0)[1].trim();
                if (day.length() < 2) {
                    day = "0" + day;
                }
                if (month.length() < 2) {
                    month = "0" + month;
                }
                Intent intent = new Intent(TrainDetails.this, IRCTCWeb.class);
                intent.setAction(IRCTCWeb.BOOK);
                intent.putExtra(TrainEnquiry.SRC, mSrc);
                intent.putExtra(TrainEnquiry.DST, mDst);
                intent.putExtra(TrainEnquiry.DAY_TRAVEL, day);
                intent.putExtra(TrainEnquiry.MONTH_TRAVEL, month);
                intent.putExtra(TrainEnquiry.CLS, mCls);
                //Toast.makeText(TrainDetails.this,"Day is: " + day + " Month is: " + month,Toast.LENGTH_LONG).show();
                dialog.dismiss();
                startActivity(intent);
            }
        });
        builder.setNegativeButton("No Thanks", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.create().show();
        break;
    }
}