oh how I love Java

Lubomir I. Ivanov neolit123 at gmail.com
Thu Jun 29 18:51:03 PDT 2017


On 30 June 2017 at 03:58, Dirk Hohndel <dirk at hohndel.org> wrote:
> So how the heck do I get an int return value out of a JNI call???
>
> I've tried quite a few different variations of this
>
>                         // returns a BluetoothDevice
>                         QAndroidJniObject dev=iterator.callObjectMethod("next","()Ljava/lang/Object;");
>                         if (checkException("Iterator<BluetoothDevice>.next()", &dev)) {
>                                 continue;
>                         }
>                         QAndroidJniObject typeObj = dev.callObjectMethod("getType", "()I");
>
> getType() returns an int. I want to check if this is an LE-only device.
>

untested:

http://doc.qt.io/qt-5/qandroidjniobject.html#callMethod

jint type_jni = dev.callMethod<jint>("getType");
int type_c = (int)type_jni;

^
https://android.googlesource.com/platform/libnativehelper/+/master/include/nativehelper/jni.h#35

lubomir
--


More information about the subsurface mailing list