Hide Soft Input in OnCreate

android, xamarin.android

Solution

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

Problem

I have a TableLayout that I am dynamically adding content to in code in OnCreate. Once the Activity creates, it is focusing on one of my dynamically created EditTexts and displaying the keyboard. I don't want the keyboard to display until the user specifically presses one of the EditTexts. I've tried: ``` InputMethodManager input = (InputMethodManager) GetSystemService(InputMethodService); input.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0); ``` But the keyboard still displays and CurrentFocus returns null. So when I attempt to specifically point the focus to another view and then perform the above like: ``` InputMethodManager input = (InputMethodManager) GetSystemService(InputMethodService); title.FindFocus(); input.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0); ``` CurrentFocus is still null and the keyboard still displays. title is a TextView that I already have an instance of in code. Can I just not give focus to a TextView or is there something else I'm missing?

Original source