Hello,
Welcome to Microsoft Q&A!
The normal solution is to create a global static variable in MainActivity
, assign the value in OnCreate
, and access it from RecyclerView.Adapter
.
MainActivity
public static MainActivity Instance;
protected override void OnCreate(Bundle savedInstanceState)
{
Instance = this;
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
Adapter
//somewhere
((InputMethodManager)MainActivity.Instance.GetSystemService(InputMethodService));
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.