Forum Xamarin.Android

dismissing keyboard

I have an app that takes all input from a laser barcode scanner.
Therefore I always want to hide the keyboard popup.

I use an EntryRenderer that seems to do the trick.
I also used a DependencyService to dismiss the keyboard.

However since upgrading Xamarin Forms from 3.4 to 4.2 things are a bit wierd.

The EntryRenderer seems to work perfectly find on my login screen Entry. I set focus OnAppearing and it dismisses the keyboard no problems.

However, on a screen about 3 levels down into my app, I use the exact same Entry control and the keyboard will not dismiss via the renderer.
I set the focus, and it calls the renderer code to dismiss, but then when the screen loads it shows the keyboard.
Using DependencyService seems to no longer work as an override.

1) why does the renderer fail on one screen but not the other?
2) why does my DependencyService fail to work at all? Code:
var imm = InputMethodManager.FromContext(MainActivity.Instance);
imm.HideSoftInputFromWindow(MainActivity.Instance.Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);

Sign In or Register to comment.