Q:

just one Edit instead of two ( AlertDialog )

new day - new problem :
i want to have a button, which starts an AlertDialog, in which the user can change the range for a random number
my problem is : it only shows one edit, and i don't know why
(btw : the app doesn't crash : i get a random number, i just don't know where it comes from )
below is my code : 
String s;

public void btn_own(View view) {
    int a, b, c;        // a : untere Grenze , b : obere Grenze

    AlertDialog.Builder alert = new AlertDialog.Builder(this);

        alert.setTitle("Enter range");

        final EditText inputa = new EditText(this);
        final EditText inputb = new EditText(this);
        alert.setView(inputa);
        alert.setView(inputb);

            alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    int aa = 0;
                    int bb = 0;
                    int cc = 0;
                    int e = 0;
                    try {
                        aa = Integer.parseInt(inputa.getText().toString());
                    }   catch (NumberFormatException f) {
                        System.out.println("not a number: " + inputa.getText().toString());
                        f.printStackTrace();
                    }

                    try {
                        bb = Integer.parseInt(inputb.getText().toString());
                    }   catch (NumberFormatException g) {
                        System.out.println("not a number: " + inputb.getText().toString());
                        g.printStackTrace();
                    }
                    cc = bb - aa;
                    Random rand = new Random();
                    int d = rand.nextInt(cc);
                    e = d + bb;
                    Integer out = new Integer(e);
                    s = out.toString();

                    new AlertDialog.Builder(Decider.this)
                            .setMessage(s)
                            .show();

                }
            });
        alert.show();

}   

hope you can help me .. i am new in development and that's my first real project 

A:

the second view it s overriding the first in AlertDialog you put only one view! so use a linearlayout trick as here below:
String s;
public void btn_own(View view) {
    int a, b, c;        // a : untere Grenze , b : obere Grenze

AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Enter range");
     LinearLayout linearLayout = new LinearLayout(context);
     linearLayout.setOrientation(1);
     linearLayout.setGravity(Gravity.CENTER);

    final EditText inputa = new EditText(this);
    final EditText inputb = new EditText(this);
     linearLayout.addView(inputa );
     linearLayout.addView(inputb );

    alert.setView(linearLayout );

        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {

                int aa = 0;
                int bb = 0;
                int cc = 0;
                int e = 0;
                try {
                    aa = Integer.parseInt(inputa.getText().toString());
                }   catch (NumberFormatException f) {
                    System.out.println("not a number: " + inputa.getText().toString());
                    f.printStackTrace();
                }

                try {
                    bb = Integer.parseInt(inputb.getText().toString());
                }   catch (NumberFormatException g) {
                    System.out.println("not a number: " + inputb.getText().toString());
                    g.printStackTrace();
                }
                cc = bb - aa;
                Random rand = new Random();
                int d = rand.nextInt(cc);
                e = d + bb;
                Integer out = new Integer(e);
                s = out.toString();

                new AlertDialog.Builder(Decider.this)
                        .setMessage(s)
                        .show();

            }
        });
    alert.show();

}   

