Monodroid,互操作悫Java和C#操作、Monodroid、Java

2023-09-03 04:06:10 作者:姿态动人

我们有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 :

调用的.jar库中的Java功能,从单声道应用

但是,我们不能打电话,启动Java活动。这可能吗?

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

第二个问题是,我们不知道如何沟通从Java到单声道。是不是也可以吗?

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

推荐答案

您可以方便地调用从本地code Java的活动是这样的:

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

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

当我从理解这篇文章您可以调用从Java本机code通过ACW,但我认为这是太困难了。

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