1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
AlertDialog.Builder alert = new AlertDialog.Builder(this);
 
        alert.setTitle("Title");
        alert.setMessage("Message");
 
        // Set an EditText view to get user input
        final EditText input = new EditText(this);
        alert.setView(input);
 
        alert.setPositiveButton("Ok"new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                String value = input.getText().toString();
                value.toString();
                // Do something with value!
            }
        });
 
        alert.setNegativeButton("Cancel",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Canceled.
                    }
                });
        
        alert.show(); 
cs


+ Recent posts