Set the view of dialog with two EditTexts - Android User Interface

Android examples for User Interface:EditText

Description

Set the view of dialog with two EditTexts

Demo Code

import android.app.AlertDialog;
import android.content.Context;
import android.widget.EditText;
import android.widget.LinearLayout;

public class Main {
  /**/* w w  w. j  ava  2 s. com*/
   * Set the view of dialog with two EditTexts
   * 
   * @param alert
   *          AlertDialog
   * @param editText1
   *          First EditText
   * @param editText2
   *          First EditText
   */
  public static void setDialogView(Context context, AlertDialog.Builder alert,
      EditText editText1, EditText editText2) {
    LinearLayout ll = new LinearLayout(context);
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(editText1);
    ll.addView(editText2);
    alert.setView(ll);
  }
}

Related Tutorials