I'm trying to close the softkeyboard that is opened in another app. I tried every solution from here: Programmatically Hide/Show Android Soft Keyboard or here: Close/hide the Android Soft Keyboard
As you can see in the pictures i have to close the keyboard opened from another app, adding to manifest to don't make the keyboard visible didn't make the trick.
To note that this is a locker app, i start an activity when the phone goes to sleep mode.
Am i missing something ? Testing other locker apps from store and didn't encountered this problem
But here is the result:
Edit: More info
This is how i start the locker:
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//Toast.makeText(context, "" + "screeen off", Toast.LENGTH_SHORT).show();
wasScreenOn = false;
Intent intent = new Intent(context, LockScreenActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
// do whatever you need to do here
//wasScreenOn = false;
}
This is the manifest code:
<activity
android:name=".ui.activities.LockScreenActivity"
android:excludeFromRecents="true"
android:noHistory="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />