-1

I have Here library written in Java for Android which I have wrapped to C# Android library

In Java there was the following code:

    @FunctionalInterface
    public interface LoadSceneCallback {
        void onLoadScene(@Nullable MapError var1);
    }

code in Java used as anonymous class:

    mapView.getMapScene().loadScene(MapScheme.NORMAL_DAY, new MapScene.LoadSceneCallback() {
        ...
    }

C# wrapper generates the following code:

        // Metadata.xml XPath interface reference: path="/api/package[@name='com.here.sdk.mapview']/interface[@name='MapScene.LoadSceneCallback']"
        [Register ("com/here/sdk/mapview/MapScene$LoadSceneCallback", "", "Com.Here.Sdk.Mapview.MapScene/ILoadSceneCallbackInvoker")]
        public partial interface ILoadSceneCallback : IJavaObject, IJavaPeerable {

            // Metadata.xml XPath method reference: path="/api/package[@name='com.here.sdk.mapview']/interface[@name='MapScene.LoadSceneCallback']/method[@name='onLoadScene' and count(parameter)=1 and parameter[1][@type='com.here.sdk.mapview.MapError']]"
            [Register ("onLoadScene", "(Lcom/here/sdk/mapview/MapError;)V", "GetOnLoadScene_Lcom_here_sdk_mapview_MapError_Handler:Com.Here.Sdk.Mapview.MapScene/ILoadSceneCallbackInvoker, HereApi.Android")]
            void OnLoadScene (global::Com.Here.Sdk.Mapview.MapError p0);

        }

Actually I cannot figure out how to use it ... when I inherits from it I have to implement not only void onLoadScene(@Nullable MapError var1), but also tones of Java methods ... :(

Have somebody faced with the same issue ? How to use such generated code

Denis Kotov
  • 857
  • 2
  • 10
  • 29
  • Is there a `JavaObject` you can inherit from to get most of that implementation? – juharr Jun 30 '20 at 16:48
  • @juharr In Java there is just anonymous class used, but what should be done on C# side ? – Denis Kotov Jun 30 '20 at 16:58
  • I mean does it include a C# class called something like `JavaObject` that implements most of the stuff in `IJavaObject`. – juharr Jun 30 '20 at 17:02
  • `JavaObject` does not help because it requires to implement `HandlePtr` ... instead I have used `Java.Lang.Object` and it solves my issue – Denis Kotov Jun 30 '20 at 17:49

1 Answers1

-1

I have fixed this issue with inheriting from Java.Lang.Object that implements most of boilerplate code

Also special thanks to @juharr for support !!

Denis Kotov
  • 857
  • 2
  • 10
  • 29