How to get Android.Content.Context object in Android head

149 Views Asked by At

I'm working on integrating an java binding project, and I need to pass an Android.Content.Context object to the method, how do I get that in Uno?

1

There are 1 best solutions below

0
On BEST ANSWER

To get the current Android Context within an Uno app you can use the Uno.UI.ContextHelper.Current property.

Simple example:

#if __ANDROID__
    public partial class CustomNativeScrollView : Android.Widget.ScrollView
    {
        public CustomNativeScrollView() : base(Uno.UI.ContextHelper.Current)
        {

        }

    ...