I wanted to get a virtual keyboard on click of a button and when the button takes focus.the following code works only for on focus,but does not work for the onClickListner.
How do I get the virtual keyboard on click of a button?Any help --------------------------------------------------------------- final Button button = new Button(this); //button.requestFocusFromTouch(); button.setOnFocusChangeListener(new OnFocusChangeListener(){ public void onFocusChange(View view, boolean hasFocus) { if(hasFocus){ final InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, 0); } } }); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { final InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(v, 0); } }); ---------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---