@Override public int[] getInputDeviceIds() { return mInputManager.getInputDeviceIds(); }
boolean sPen = false; if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { if(inptmgr.getInputDevice(inputs[i]).getName().toLowerCase().contains("pen")) sPen = true; } }
if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { String devicename = inptmgr.getInputDevice(inputs[i]).getName(); if(devicename.toLowerCase().contains("mouse")) { } else if(devicename.toLowerCase().contains("keyboard")) { } } }
boolean sPen = false; if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { if(inptmgr.getInputDevice(inputs[i]).getName().toLowerCase().contains("pen")) sPen = true; } }
@Override protected void onResume() { super.onResume(); // Register an input device listener to watch when input devices are // added, removed or reconfigured. mInputManager.registerInputDeviceListener(this, null); // Query all input devices. // We do this so that we can see them in the log as they are enumerated. int[] ids = mInputManager.getInputDeviceIds(); for (int i = 0; i < ids.length; i++) { getInputDeviceState(ids[i]); } }
@Override protected void onResume() { super.onResume(); // Register an input device listener to watch when input devices are // added, removed or reconfigured. mInputManager.registerInputDeviceListener(this, null); // Query all input devices. // We do this so that we can see them in the log as they are enumerated. int[] ids = mInputManager.getInputDeviceIds(); for (int i = 0; i < ids.length; i++) { getInputDeviceState(ids[i]); } }