Hi, I have a recyclerview and an adapter for it with an EditText. I want hide the keyboard when hits EditText los the focus. I tried using InputMethoManager (imm = (InputMethodManager)GetSystemService(Context.InputMethodService) but I'm receiving an error in GetSystemService and in the InputMethodService that says that "GetSystemService doesn't exist in the current context".
public class MilestonesViewHolder : RecyclerView.ViewHolder
{
InputMethodManager imm;
public EditText Title { get; private set; }
public MilestonesViewHolder(View itemView) : base(itemView)
{
MainView = itemView;
Title = itemView.FindViewById(Resource.Id.tv_milestones_title);
imm = (InputMethodManager)GetActivity().GetSystemService(Context.InputMethodService);
Title.AfterTextChanged += Title_AfterTextChanged;
Title.FocusChange += Title_FocusChange;
}
private void Title_FocusChange(object sender, View.FocusChangeEventArgs e)
{
if (!e.HasFocus)
{
imm.HideSoftInputFromWindow(Title.WindowToken, 0);
}
}
}