How to show the numeric keypad

I read several other posts and using input.setInputType(TYPE_NUMBER_FLAG_DECIMAL); does open the keyboard but its not the numeric keyboard

Is there a trick to this?

  • Android exploit dalvik classes: Preferences
  • Using Navigation Drawer in older android
  • Best way to get a SpannableString from a SpannableStringBuilder
  • Android PackageStats gives negative Values
  • Change package name to existing Phonegap projects
  • How to check VPN connection status on Android ICS
  • Related posts:

    Quickest way to duplicate an android project?
    Location Manager's requestLocationUpdates called only once
    How do Android apps like Facebook, Whatsapp have services in foreground without notification?
    Android, catch webview redirection url
    android child view ignore parent padding
    Android: Default XML Editor isn't opening anymore
  • Android FB API 3.0 - set permissions only once
  • What should I pass for root when inflating a layout to use for a MenuItem's ActionView?
  • How to get all keys of SharedPreferences programmatically in Android?
  • Clickable image - android
  • Build issue when using <cmath> with android ndk
  • Repackaged Android App drawing issues on Blackberry Playbook simulator
  • 4 Solutions collect form web for “How to show the numeric keypad”

    android:inputType="number" inside your xml file

    Edit: “Number” does not work, changed to “number” (lowercase N)

    a) in xml


    b) in code

    EditText editView = new EditText(this);
    editView.setKeyListener(new DigitsKeyListener());

    In your xml, you have to do this:


    In your code, do:



    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);

    Took me many days to figure this out. I even tried editText.performClick(); Not working.

    To pop up a numeric keyboard on start of the activity i used following steps:

    Created edit text field in layout as:

            ...  />

    In function onCreate() show soft keyboard

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    Most important is to give focus to edit text in onResume method.

        public void onResume() {
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.