mono for android 百度map binding项目(转)

好丫小子之前发布过百度地图android SDK的mono for android绑定dll,许多朋友看过之后说想理解是怎么绑定的,现我把绑定的代码发出来。

针对2.1.2版本百度地图android sdk

Metadata.xml

<metadata>
<remove-node path="/api/package[@name='com.baidu.mapapi.cloud']/class[string-length (@name) = 1]" />
  <remove-node path="/api/package[@name='com.baidu.mapapi.search']/class[@name = 'PlaceCaterActivity']" />
  <remove-node path="/api/package[@name='com.baidu.platform.comapi.map']/class[string-length (@name) = 1 and @name!='u'  and @name!='z']" />
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='u']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='u']" name="managedName">Overlay</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='z']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='z']" name="managedName">TransitOverlay</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='z']" name="extends">java.lang.Object</attr>
  <attr path="/api/package[@name='com.baidu.vi']/class[@name='d']" name="obfuscated">false</attr>
 
  <attr path="/api/package[@name='com.baidu.platform.comjni.permissioncheck']" name="managedName">Com.Baidu.Platform.Comjni._PermissionCheck</attr>
</metadata>

 

在Additions目录中新增一个Fx.cs文件,文件内代码如下

using System;
using System.Collections.Generic;
using System.Text;
using Object = Java.Lang.Object;
 
namespace Com.Baidu.Mapapi.Map
{
    public partial class ItemizedOverlay
    {
        public int Compare(Object object1, Object object2)
        {
            return object1.GetHashCode() - object2.GetHashCode();
        }
    }
}

 

这部分代码主要是修正ItemizedOverlay类没实现基类的public int Compare(Object object1, Object object2)方法的错误

针对2.1.3版本百度地图android sdk

Metadata.xml

<metadata>
  <!--
  This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
  <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
 
  This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
  <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
  -->
  <remove-node path="/api/package[@name='com.baidu.mapapi.cloud']/class[string-length (@name) = 1]" />
  <remove-node path="/api/package[@name='com.baidu.mapapi.search']/class[@name = 'PlaceCaterActivity']" />
  <remove-node path="/api/package[@name='com.baidu.vi']/class[@name = 'VDeviceAPI']" />
  <remove-node path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name = 'd']" />
  <remove-node path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name = 'y']" />
 
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='v']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='v']" name="managedName">Overlay</attr>
 
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='A']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='A']" name="managedName">TransitOverlay</attr>
  <attr path="/api/package[@name='com.baidu.platform.comapi.map']/class[@name='A']" name="extends">java.lang.Object</attr>
 
  <attr path="/api/package[@name='com.baidu.platform.comjni.permissioncheck']" name="managedName">Com.Baidu.Platform.Comjni._PermissionCheck</attr>
</metadata>

同样,在Additions增加以上Fx.cs文件及代码

具体代码请见
http://code.taobao.org/p/monodriodbindings/src/
用svn导出
使用方法见我之前的文章
Mono For Android中完美使用百度地图SDK(v2.1.2&v2.1.3)

 

 

转载自http://mdev.iquan.net/mono-for-android-baidumap-binding/

posted @ 2013-09-03 14:47  寒殇  阅读(661)  评论(0编辑  收藏  举报