Thanks! You have a gift to wake me up from stupidity :). I actually implemented everything correctly, except that I've made the uber obvious mistake to call the IM in the onCreate() function of the activity. I guess I should have used at least onWindowFocusChanged(). Sorry for wasting your time.
On Fri, Aug 14, 2009 at 7:55 PM, Dianne Hackborn <hack...@android.com>wrote: > Do the same thing TextView does. > > On Fri, Aug 14, 2009 at 8:33 AM, Andrei Bucur <andrei.bu...@gmail.com>wrote: > >> Hello! >> AbsListView implements onCreateInputConnection using an EditText, subclass >> of TextView :). My question is how should a custom View implement those >> methods so one can display the virtual keyboard. >> Andrei. >> >> On Fri, Aug 14, 2009 at 6:23 PM, greg <sep...@eduneer.com> wrote: >> >>> >>> I put the following menu option in my application to display the >>> keyboard: >>> >>> case R.id.keyboard: >>> Toast.makeText(this, "Back button removes keyboard.", >>> Toast.LENGTH_SHORT).show(); >>> InputMethodManager imm = >>> (InputMethodManager)getSystemService >>> (Context.INPUT_METHOD_SERVICE); >>> imm.showSoftInput(mListView, >>> InputMethodManager.SHOW_FORCED); >>> return true; >>> >>> - - - >>> >>> I hope that helps. >>> >>> - Greg >>> >>> >>> On Aug 14, 8:58 am, loctarar <andrei.bu...@gmail.com> wrote: >>> > Hello! >>> > >>> > I need help with showing the integrated virtual keyboard on-screen. I >>> > extended a View class and I implemented these two methods (most of it >>> > is just stub code; for now I only want to display the keyboard): >>> > @Override >>> > public InputConnection onCreateInputConnection (EditorInfo >>> outAttrs) >>> > { >>> > BaseInputConnection fic = new BaseInputConnection(this, >>> true); >>> > >>> > outAttrs.actionLabel = null; >>> > outAttrs.hintText = "Insert the test text"; >>> > outAttrs.initialCapsMode = 0; >>> > outAttrs.initialSelEnd = outAttrs.initialSelStart = -1; >>> > outAttrs.label = "Test text"; >>> > outAttrs.inputType = InputType.TYPE_CLASS_NUMBER | >>> > InputType.TYPE_NUMBER_FLAG_DECIMAL; >>> > outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; >>> > >>> > return fic; >>> > } >>> > >>> > @Override >>> > public boolean onCheckIsTextEditor() { >>> > return true; >>> > } >>> > >>> > In the onCreate method of my activity I have : >>> > >>> > InputMethodManager imm = >>> (InputMethodManager)this.getSystemService >>> > (Context.INPUT_METHOD_SERVICE); >>> > imm.showInputMethodPicker(); >>> > >>> > imm.showSoftInput(editor, InputMethodManager.SHOW_FORCED); >>> > >>> > Where editor is an instance of my View. I noticed in the debugger that >>> > my onCreateInputConnection() is executed but after that the keyboard >>> > is not displayed on the screen. >>> > Using the TextView widtget and it's subclasses is not an option. >>> > >>> > Thank you! >>> >>> >> >> >> > > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---