开发者

Access the current android activity

开发者 https://www.devze.com 2023-03-05 11:46 出处:网络
How can I access the current Android activity class? 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

How can I access the current Android activity class?

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; lm = (LocationManager) getSystemService(LOCATION_SERVICE);

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 tha开发者_高级运维t is running my QT application, so I can call the function getSystemService.

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


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

Carlos.

0

精彩评论

暂无评论...
验证码 换一张
取 消