【发布时间】:2011-05-16 12:50:05
【问题描述】:
我正在使用 Necessitas(Android 中的 QT)。基本上,使用 Android NDK 一个 android 活动调用一个 QT 应用程序 (.so)。
我正在为 GPS 做一些绑定。我想我到了那里,但是当我调用 requestLocationUpdates(String, Long, Float, LocationListener) 方法时,我收到了 JNI WARNING (JNI Warning expected return type 'L')。
以下是部分代码:
midGetSystemService = currEnv->GetMethodID(actClass,"getSystemService","(Ljava/lang/String;)Ljava/lang/Object;");
jSystemServiceObj = currEnv->CallObjectMethod(currAct,midGetSystemService,StringArg);
midRequestLocationUpdates = currEnv->GetMethodID(locManClass,"requestLocationUpdates","(Ljava/lang/String;JFLandroid/location/LocationListener;)V");
midConstListener = currEnv->GetMethodID(listenerClass, "<init>", "()V");
jListenerObj = currEnv->NewObject(listenerClass, midConstListener);
currEnv->CallObjectMethod(jSystemServiceObj,midRequestLocationUpdates,StringArg,(jlong)1000,(jfloat)10,jListenerObj); --->Here is the warning
知道为什么吗?
【问题讨论】:
-
嗨,这是因为我需要调用 CallVoidMethod 而不是 CallObjectMethod。对不起这个愚蠢的问题.....我累了:-(卡洛斯。
标签: android java-native-interface android-ndk