Monodroid,Java 和 C# 之间的互操作 [英] Monodroid, Interop betwen Java and C#

查看:27
本文介绍了Monodroid,Java 和 C# 之间的互操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 Android 下有一个很大的 Java 应用程序(大"只是意味着翻译应用程序的工作量太大).我们必须访问一个用 .Net 编写的引擎(这个引擎也太大"了......).这个引擎只是计算.

We have a big Java application under Android ("big" just means it's too much work to translate the application). We must access to an engine written in .Net (this engine is also too "big" ...). This engine is only calculation.

因此,我们寻求使用 monodroid 的解决方案.我们的主要问题是 monodroid 和 Java 之间的互操作.这时候,我们得到:

We therefore seek a solution with monodroid. Our main problem is interop betwen monodroid and Java. At this time, we get :

  • 从 Mono 应用程序调用 .jar 库中的 Java 函数

但是我们无法调用和启动 Java 活动.可能吗?

But we can not call and start a Java activity. Is it possible ?

第二个问题是我们不知道如何从 Java 到 Mono 进行通信.也可以吗?

The second problem is that we do not know how to communicate from Java to Mono. Is it also possible?

推荐答案

您可以像这样从本机代码轻松调用 Java 活动:

You can easily call Java activity from native code like this:

var intent = new Intent().SetClassName(this,"com.myapp.java.JavaActivity");
StartActivity(intent);

正如我从 这篇文章 中了解到的,您可以通过 ACW 从 Java 调用本机代码,但我觉得太难了

As I understood from this article you can invoke native code from Java via ACW, but I think that it's too difficult

这篇关于Monodroid,Java 和 C# 之间的互操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆