I Want to show and dismiss the keyboard on edit Text ??

24 views
Skip to first unread message

Sana Rajput

unread,
Sep 14, 2018, 3:21:18 AM9/14/18
to XWT Widget Toolkit

I have showed Numeric keyboard on edit Text by using the following code,

InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.NotAlways);

now if i press the Home button of the device it still show me the keyboard,
Please help me out to resolve this issue
Thanks in advance.

akshita...@gmail.com

unread,
Sep 18, 2018, 2:09:46 AM9/18/18
to XWT Widget Toolkit
Hi Sana, I got the solution, use following code in onPause(),

InputMethodManager inputManager = (InputMethodManager)GetSystemService(Context.InputMethodService);
var currentFocus = this.CurrentFocus;
if (currentFocus != null)
{
inputManager.HideSoftInputFromWindow(currentFocus.WindowToken, HideSoftInputFlags.None);
}

--
If you still need help regarding Xamarin Development feel free to contact me.
Reply all
Reply to author
Forward
0 new messages