How to manually dismiss the keypad in Android

If you want to dismiss the keypad manually through code, you can do that with the following methods Method 1: @Override public boolean dispatchTouchEvent(MotionEvent event) { View view = getCurrentFocus(); boolean ret = super.dispatchTouchEvent(event); if (view instanceof EditText) { View w = getCurrentFocus(); int scrcoords[] = new int[2]; w.getLocationOnScreen(scrcoords); float…continue reading →
How to open only default camera without showing chooser in Android

How to open only default camera without showing chooser in Android

In some cases you might want to open only default camera of the device without showing chooser of 3rd party camera applications. You can try following code, its working perfectly fine in my case. PackageManager packageManager = context.getPackageManager(); List<ApplicationInfo> list = packageManager .getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES); for (int n = 0; n <…continue reading →