gaara87
gaara87

Reputation: 2077

Android onscreen keyboard without any other keyboard

I've looked at several questions and come across several posts, but i'm not able to figure out how to do this.

The following picture shows you the basic layout : enter image description here

I've created a custom numpad and put it up on the repo.

Currently, when the app opens, the edit text has the focus but and anything i enter with the keyboard will go into the edittext box. This part of the functionality works fine.

Problem: When i touch the edittext again, system Input Method with its huge keyboard pops up. How do i completely block it from popping up? Or, can i tell the app to use only my keyboard instead of the system one? (Or is the only way to write a custom ime?)

i cannot use NULL type input at the manifest because doing that makes the caret in the edittext disappear and moreover if there are two edit texts, i wouldnt know which has focus.

Any help would be highly appreciated!

Upvotes: 0

Views: 688

Answers (1)

Cruceo
Cruceo

Reputation: 6834

You can do a few things:

  1. Programmatically hide it in the whole app:

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    
  2. Hide it from the view it would be attached to:

    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0);
    
  3. Set the input type of the EditText to 0:

    EditText yourEditText=(EditText)findViewById(R.id.editTextConvertValue);
    yourEditText.setInputType(0);
    

Upvotes: 1

Related Questions