As title.

I need a simple way that asks the user to input some data and let him
press ok or cancel to enter the data.

What is the easyest way to do it that works ok from android 2.1 to
android 3.2?

I'm using the AlerDialog with an EditText in it.
This alert is shown on the top of my canvas.

void alertInputStr(String title, String message, int
numeroCampoEditabile) {
        AlertDialog.Builder alertI = new AlertDialog.Builder(this);
        final int num = numeroCampoEditabile;
        alertI.setTitle(title);
        alertI.setMessage(message);
        input = new EditText(this);
        alertI.setView(input);
        alertI.setPositiveButton("Ok", new
DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int
whichButton) {
                Editable value = input.getText();
                String valInput;
                try {
                    valInput = value.toString();
                } catch (Exception e) {
                    valInput = "";
                }
                switch (num) {
                    case 1:
                        Home.to = valInput;
                        instance.setContentView(new
SendMail(instance));
                        break;
                }
            }
        });
        alertI.setNegativeButton("Cancel", new
DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int
whichButton) {
            }
        });
        alertI.show();

}



The problem is that in this way I can't find a reasonable way to open
the softkeyboard automatically.
Android <=2.3 don't show the soft keyboard automatically, android >2.3
shows the softkeyboard automatically.

Since I'm crashing my head from days on this, what is the easyest way
to let the user input some data when tapping on an edittext or
something similar?

Obviously only one tap is required to show softkeyboard.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to