on the alert code I posted previously this doesn not show the softkeyboard InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);
and this does not hide it? InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(input.getWindowToken(), 0); can't belive that an easy task like that is so problematic. On Sep 5, 5:59 pm, sblantipodi <perini.dav...@dpsoftware.org> wrote: > 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