Java tutorial
//package com.java2s; import android.text.InputType; public class Main { /** Returns true if number keyboard is preferred by EditorInfo.inputType. */ public static boolean isNumberKeyboardPreferred(int inputType) { int typeClass = inputType & InputType.TYPE_MASK_CLASS; // As of API Level 21, following condition equals to "typeClass != InputType.TYPE_CLASS_TEXT". // However type-class might be added in future so safer expression is employed here. return typeClass == InputType.TYPE_CLASS_DATETIME || typeClass == InputType.TYPE_CLASS_NUMBER || typeClass == InputType.TYPE_CLASS_PHONE; } }