6

I know how to open a soft keyboard and even handle its key events. I need to open Numeric keyboard.

P.S I am not using Edittexts in layout file.

Here is the code I am using to open keyboard programmatically

    if (PasscodeLockUpdated.this != null) {
    PasscodeLockUpdated.this .getWindow()
    .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);}
BST Kaal
  • 2,993
  • 6
  • 34
  • 52
ShahrozKhan91
  • 710
  • 10
  • 19
  • So how did you solve it? I am trying to achieve the same thing. – Kartik Feb 10 '15 at 00:47
  • @KartikKaushik I had to make a custom keyboard of my own in form of a fragment and communicate with it with callbacks and now whenever i need it, i just pop it up on the screen with a sliding animation. – ShahrozKhan91 Feb 10 '15 at 05:40
  • Thanks @Shahroz, I also made my own keyboard using tableLayout. – Kartik Feb 10 '15 at 06:51

1 Answers1

0

Are you adding an EditText programmatically? If so, you can change the InputType (as you would if you had xml) in java using:

yourEditText.setInputType(InputType.TYPE_CLASS_NUMBER | **Another type if you want more than one**);

Hope that helps.

CodeMonkey
  • 1,426
  • 1
  • 14
  • 32
  • 1
    No I am not using edittext at all. I want to fill the textviews with default keyboard input. – ShahrozKhan91 Aug 12 '14 at 05:14
  • Well, that clears that up. Have you checked [this answer](http://stackoverflow.com/a/5684661/716588) to a similar question? This answer uses a `class MyInputConnection extends BaseInputConnection` to capture input from the keyboard and `setText` a `TextView`. – CodeMonkey Aug 12 '14 at 05:32
  • 1
    Sorry, I've deviated from the original question with that last comment. I got distracted. I'll have to leave it for someone else to answer I'm afraid. – CodeMonkey Aug 12 '14 at 05:37