I have an application that is just a surfaceview. All i do is draw stuff on the surfaceview and whatnot. So one functionality i want is if the user touches a corner of the surfaceview it shows the keyboard and then they can type into it. Note that there are no EditTexts or Textboxes in my app anywhere. How do i call the keyboard to pop up and then how do i get all the keys that the user is pressing? I don’t want the keys necessarily, i just want the string that they typed. How do i go about accomplishing this?
Share
This is not a trivial task.
First of all, you’ll need to override the method onCreateInputConnection()
Then you’ll have to implement this input connection class, deriving from BaseInputConnection.
There are more methods you’ll want to override (see the reference), but start by focusing on commitText(). DrawText() is a method that renders the text on your surface, you’ll have to come up with an implementation that suits your needs.