进入目前的Andr​​oid活动目前、Andr、oid

2023-09-12 05:20:23 作者:降妞十巴掌

如何进入目前的Andr​​oid Activity类?

How can I access the current Android activity class?

我使用的是necessitas框架(QT Android中)。基本上,使用Android NDK活动调用Qt应用程序(的.so)。所有运行良好。现在我工作的一些绑定从Qt应用程序访问GPS。从访问的GPS一些Java例子我看到的最重要的部分是允许访问GPS服务:

I am using the necessitas framework (QT in Android). Basically, using the Android NDK an activity calls a QT application (.so). All runs fine. Now I am working on some bindings to access the GPS from the QT application. From some java examples that access the GPS I saw that the most vital part is to allow access to the GPS service:

LocationManager流明; LM =(LocationManager)getSystemService(LOCATION_SERVICE);

LocationManager lm; lm = (LocationManager) getSystemService(LOCATION_SERVICE);

下面getSystemService是课堂活动的方法。因为我使用JNI的Qt应用程序,我需要访问运行我的Qt应用程序的当前活动里面,这样我就可以调用该函数getSystemService。

Here getSystemService is a method of class activity. Because I am using the JNI inside the QT application I need to access the current activity that is running my QT application, so I can call the function getSystemService.

所以,问题是。我如何在我的QT应用程序从运行当前的活动?

So the question is. How do I get the current activity where my QT application is running from?

推荐答案

我通过JNI的RegisterNatives();通过当前的应用程序(运行我的QT应用程序),以我的Qt应用程序解决了这个

I solved this by passing the current application (running my QT application) to my QT application using JNI's RegisterNatives().

卡洛斯。