Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What if you try with a <code>LinerLayout</code> :</p> <pre><code>LinearLayout lila1= new LinearLayout(this); lila1.setOrientation(LinearLayout.VERTICAL); final EditText input = new EditText(this); final EditText input1 = new EditText(this); lila1.addView(input); lila1.addView(input1); alert.setView(lila1); </code></pre> <p>Like this:</p> <pre><code>public class LoginActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btn= (Button) findViewById(R.id.btn_Login); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialog(0); } }); } protected Dialog onCreateDialog(int id) { final AlertDialog.Builder alert = new AlertDialog.Builder(this); LinearLayout lila1= new LinearLayout(this); lila1.setOrientation(1); //1 is for vertical orientation final EditText input = new EditText(this); final EditText input1 = new EditText(this); lila1.addView(input); lila1.addView(input1); alert.setView(lila1); alert.setIcon(R.drawable.icon); alert.setTitle("Login"); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString().trim(); Toast.makeText(getApplicationContext(), value, Toast.LENGTH_SHORT).show(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); return alert.create(); } } </code></pre> <p>And it works perfectly : I invite you to copy paste it :).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload