Access the current android activity
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.
精彩评论