Java Code Examples for

The following are Jave code examples for showing how to use setView() of the class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: editor   File:   Source Code and License Vote up 6 votes
private void saveAsDialog(int title, int message, String path,
                          DialogInterface.OnClickListener listener)
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    // Add the buttons
    builder.setPositiveButton(, listener);
    builder.setNegativeButton(R.string.cancel, listener);

    // Create edit text
    Context context = builder.getContext();
    EditText text = new EditText(context);

    // Create the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.setView(text, 30, 0, 30, 0);;
Example 2
Project: ulogger-android   File:   Source Code and License Vote up 5 votes
 * Show dialog
 * @param context Context
 * @param title Title
 * @param layoutResource Layout resource id
 * @param iconResource Icon resource id
 * @return AlertDialog Dialog
static AlertDialog showAlert(Context context, CharSequence title, int layoutResource, int iconResource) {
    View view = ((Activity) context).getLayoutInflater().inflate(layoutResource, null, false);
    AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    if (iconResource > 0) {
    return alertDialog;