Do the same thing TextView does. On Fri, Aug 14, 2009 at 8:33 AM, Andrei Bucur <[email protected]>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 <[email protected]> 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 <[email protected]> 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 [email protected] 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

