Today we will learn another small trick to disable the softkeypad in Android
Sometime you need to disable the Soft Keypad / Virtual Keypad and want to input from either Physical Keypad or Design your own keypad.
Pretty simple and only single line code i have written below
//disable soft keypad
txtName.setInputType(InputType.TYPE_NULL);
also i made simple app to achieve this if need then have look on it.
-------------------------------------------
App Name: DisableKeypad
Package Name: com.rdc
Android SDK: Android SDK 2.3.3 / API 10
Default Activity Name: DisableKeypadActivity
-------------------------------------------
so here is the code
DisableKeypadActivity.java
main.xml
AndroidManifest.xml
Tested on Real Androd Device [Sony Ericsson (XPERIA)] the output will be like this..
I'd love to hear your thoughts!
Sometime you need to disable the Soft Keypad / Virtual Keypad and want to input from either Physical Keypad or Design your own keypad.
Pretty simple and only single line code i have written below
//disable soft keypad
txtName.setInputType(InputType.TYPE_NULL);
also i made simple app to achieve this if need then have look on it.
-------------------------------------------
App Name: DisableKeypad
Package Name: com.rdc
Android SDK: Android SDK 2.3.3 / API 10
Default Activity Name: DisableKeypadActivity
-------------------------------------------
so here is the code
DisableKeypadActivity.java
package com.rdc;
import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.widget.EditText;
public class DisableKeypadActivity extends Activity {
    private EditText txtName=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);     
        setContentView(R.layout.main);
        
        //get the id of edit text 
        txtName =(EditText) findViewById(R.id.txtName);
        
        //disable soft keypad
        txtName.setInputType(InputType.TYPE_NULL);
    }
}
main.xml
AndroidManifest.xml
Tested on Real Androd Device [Sony Ericsson (XPERIA)] the output will be like this..
I'd love to hear your thoughts!

 
No comments:
Post a Comment