Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Binding MapsForge - Problem with System.Collections.Generic.ICollection

$
0
0

Hello.

I am trying to bind mapsforge JAR. In Overlay class of this library there are many generic collections. Interface Java.Util.IList want realization like this

"Mapsforge.Android.Maps.OverlayNs.OverlayList" does not implement "Java.Util.IList.AddAll(int, System.Collections.ICollection)" 8 23 MapForgeDroid

So, i created Metadata.xml Mapsforge.Android Mapsforge.Android.Maps.OverlayNs

  <!-- Return Java.Lang.Object in OverlayManager so that we match interface. -->
    <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayCircleOverlay']/method[@name='createCircle']" name="managedReturn">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayItemizedOverlay']/method[@name='createItem']" name="managedReturn">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayWayOverlay']/method[@name='createWay']" name="managedReturn">Java.Lang.Object</attr>   

    <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayItemizedOverlay']/method[@name='getThreadName']" name="visibility">protected</attr>
    <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayCircleOverlay']/method[@name='getThreadName']" name="visibility">protected</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='ArrayWayOverlay']/method[@name='getThreadName']" name="visibility">protected</attr>

  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='add' and count(parameter)=1]/parameter[@name='p0']" name="managedType">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='add' and count(parameter)=2]/parameter[@name='p1']" name="managedType">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='retainAll']/parameter[@name='p0']" name="managedType">System.Collections.ICollection</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='removeAll']/parameter[@name='p0']" name="managedType">System.Collections.ICollection</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='containsAll']/parameter[@name='p0']" name="managedType">System.Collections.ICollection</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='addAll' and count(parameter)=1]/parameter[@name='p0']" name="managedType">System.Collections.ICollection</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='addAll' and count(parameter)=2]/parameter[@name='p1']" name="managedType">System.Collections.ICollection</attr>

  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='set']/parameter[@name='p1']" name="managedType">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='set']" name="managedReturn">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='get']" name="managedReturn">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='remove' and count(parameter)=1 and parameter[1][@type='int']]" name="managedReturn">Java.Lang.Object</attr>

  <attr path="/api/package[@name='org.mapsforge.android.maps.overlay']/class[@name='OverlayList']/method[@name='subList']" name="managedReturn">System.Collections.IList</attr>

  <attr path="/api/package[@name='org.mapsforge.android.maps.mapgenerator']/class[@name='MapGeneratorJob']/method[@name='compareTo']/parameter[@name='p0']" name="managedType">Java.Lang.Object</attr>
  <attr path="/api/package[@name='org.mapsforge.core']/class[@name='GeoPoint']/method[@name='compareTo']/parameter[@name='p0']" name="managedType">Java.Lang.Object</attr>
</metadata>

But many new erros appeared - all methods wants generic classes:

error CS1502: The best overloaded method match for  "Mapsforge.Android.Maps.OverlayNs.OverlayList.AddAll(int, System.Collections.ICollection)" has some invalid arguments   
error CS1503: Argument "2": cannot convert from "System.Collections.Generic.ICollection<Mapsforge.Android.Maps.OverlayNs.Overlay>" to "System.Collections.ICollection"     
error CS1502: The best overloaded method match for "Mapsforge.Android.Maps.OverlayNs.OverlayList.AddAll(System.Collections.ICollection)" has some invalid arguments    
error CS1503: Argument "1": cannot convert from "System.Collections.Generic.ICollection<Mapsforge.Android.Maps.OverlayNs.Overlay>" to "System.Collections.ICollection"     
error CS1502: The best overloaded method match for "Mapsforge.Android.Maps.OverlayNs.OverlayList.ContainsAll(System.Collections.ICollection)" has some invalid arguments    
error CS1503: Argument "1": cannot convert from "System.Collections.Generic.ICollection<object>" to "System.Collections.ICollection"     
error CS1502: The best overloaded method match for "Mapsforge.Android.Maps.OverlayNs.OverlayList.RemoveAll(System.Collections.ICollection)" has some invalid arguments    
error CS1503: Argument "1":  cannot convert from "System.Collections.Generic.ICollection<object>" to "System.Collections.ICollection"     
error CS1502: The best overloaded method match for "Mapsforge.Android.Maps.OverlayNs.OverlayList.RetainAll(System.Collections.ICollection)" has some invalid arguments    
error CS1503: Argument "1": cannot convert from "System.Collections.Generic.ICollection<object>" to "System.Collections.ICollection"     
error CS0266: Cannot implicitly convert type "System.Collections.Generic.IList<Mapsforge.Android.Maps.OverlayNs.Overlay>" to "System.Collections.IList".    
error CS0266: Cannot implicitly convert type "System.Collections.Generic.IList<Mapsforge.Android.Maps.OverlayNs.Overlay>" to "System.Collections.IList".

If i change type from System.Collections.ICollection to System.Collections.Generic.ICollection<Java.Lang.Object> - does not implement error. What can i do? please help me.

Regards, Pavel.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>