コード例 #1
0
void tst_QAndroidJniObject::callStaticBooleanMethod()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Boolean");
    QVERIFY(cls != 0);

    {
        QAndroidJniObject parameter = QAndroidJniObject::fromString("true");
        QVERIFY(parameter.isValid());

        jboolean b = QAndroidJniObject::callStaticMethod<jboolean>(cls,
                                                            "parseBoolean",
                                                            "(Ljava/lang/String;)Z",
                                                            parameter.object<jstring>());
        QVERIFY(b);
    }

    {
        QAndroidJniObject parameter = QAndroidJniObject::fromString("false");
        QVERIFY(parameter.isValid());

        jboolean b = QAndroidJniObject::callStaticMethod<jboolean>(cls,
                                                            "parseBoolean",
                                                            "(Ljava/lang/String;)Z",
                                                            parameter.object<jstring>());
        QVERIFY(!b);
    }
}
コード例 #2
0
void QLowEnergyControllerPrivate::readDescriptor(
        const QSharedPointer<QLowEnergyServicePrivate> service,
        const QLowEnergyHandle /*charHandle*/,
        const QLowEnergyHandle descriptorHandle)
{
    Q_ASSERT(!service.isNull());

    QAndroidJniEnvironment env;
    bool result = false;
    if (hub) {
        qCDebug(QT_BT_ANDROID) << "Read descriptor with handle"
                               <<  descriptorHandle << service->uuid;
        result = hub->javaObject().callMethod<jboolean>("readDescriptor",
                      "(I)Z", descriptorHandle);
    }

    if (env->ExceptionOccurred()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
        result = false;
    }

    if (!result)
        service->setError(QLowEnergyService::DescriptorReadError);
}
コード例 #3
0
ファイル: Wpp.cpp プロジェクト: AndrewDesign/wpp-qt
const QString Wpp::getDownloadPath() const
{
	QString downloadPath;
#if defined(Q_OS_ANDROID)
	//https://qt-project.org/forums/viewthread/35519
	QAndroidJniObject mediaDir = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
	QAndroidJniObject mediaPath = mediaDir.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" );
	downloadPath = mediaPath.toString()+"/Download/";
	QAndroidJniEnvironment env;
	if (env->ExceptionCheck()) {
		// Handle exception here.
		qDebug() << "[ERR]:Android(Extras):getting SD card download path";
		env->ExceptionClear();
	}
#elif defined(Q_OS_IOS)
	QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation);
	qDebug() << "[IOS]download paths count:" << paths.size();
	downloadPath = paths.first();
#else
	QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation);
	qDebug() << "[Other OS]download paths count:" << paths.size();
	downloadPath = paths.first();

#endif
	qDebug() << "downloadPath:" << downloadPath;
	return downloadPath;
}
コード例 #4
0
void QLowEnergyControllerPrivate::readCharacteristic(
        const QSharedPointer<QLowEnergyServicePrivate> service,
        const QLowEnergyHandle charHandle)
{
    Q_ASSERT(!service.isNull());

    if (!service->characteristicList.contains(charHandle))
        return;

    QAndroidJniEnvironment env;
    bool result = false;
    if (hub) {
        qCDebug(QT_BT_ANDROID) << "Read characteristic with handle"
                               <<  charHandle << service->uuid;
        result = hub->javaObject().callMethod<jboolean>("readCharacteristic",
                      "(I)Z", charHandle);
    }

    if (env->ExceptionOccurred()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
        result = false;
    }

    if (!result)
        service->setError(QLowEnergyService::CharacteristicReadError);
}
コード例 #5
0
QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
    const QBluetoothAddress &deviceAdapter, QBluetoothDeviceDiscoveryAgent *parent) :
    inquiryType(QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry),
    lastError(QBluetoothDeviceDiscoveryAgent::NoError),
    receiver(0),
    m_adapterAddress(deviceAdapter),
    m_active(NoScanActive),
    leScanTimeout(0),
    pendingCancel(false),
    pendingStart(false),
    lowEnergySearchTimeout(25000),
    q_ptr(parent)
{
    QAndroidJniEnvironment env;
    adapter = QAndroidJniObject::callStaticObjectMethod("android/bluetooth/BluetoothAdapter",
                                                        "getDefaultAdapter",
                                                        "()Landroid/bluetooth/BluetoothAdapter;");
    if (!adapter.isValid()) {
        if (env->ExceptionCheck()) {
            env->ExceptionDescribe();
            env->ExceptionClear();
        }
        qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth";
    }
}
コード例 #6
0
void AndroidMainWindow::fireSupportForumIntent()
{
#ifdef Q_OS_ANDROID
//    qDebug() << "fireSupportForumIntent()";
    QAndroidJniObject s1 = QAndroidJniObject::fromString("http://mdforum.designer2k2.at/viewtopic.php?f=15&t=334");
    QSettings settings;
    if ( settings.value("md/md", QVariant ( MDMODE ).toBool() )  == false ) {
        s1 = QAndroidJniObject::fromString("http://digifant-einzelabstimmung.de/bofh-ng/de/digifant-1/live-daten-auslesen");
    }


    QAndroidJniObject::callStaticMethod<void>( "de/gummelinformatics/mui/MuiIntentHelper",
                                           "openUrl",
                                           "(Ljava/lang/String;)V",
                                            s1.object<jstring>() );

    QAndroidJniEnvironment env;
    if (env->ExceptionCheck()) {
        // Handle exception here.
        qDebug() << "*** JNI exception ***";
        env->ExceptionDescribe();
        env->ExceptionClear();
        env->ExceptionClear();
    } else {
        qDebug() << "NO JNI exception";
    }

//    QDesktopServices::openUrl( QUrl("http://mdforum.designer2k2.at/") );

#endif
}
コード例 #7
0
void QBluetoothSocketPrivate::inputThreadError(int errorCode)
{
    Q_Q(QBluetoothSocket);

    if (errorCode != -1) { //magic error which is expected and can be ignored
        errorString = QBluetoothSocket::tr("Network error during read");
        q->setSocketError(QBluetoothSocket::NetworkError);
    }

    //finally we can delete the InputStreamThread
    InputStreamThread *client = qobject_cast<InputStreamThread *>(sender());
    if (client)
        client->deleteLater();

    if (socketObject.isValid()) {
        //triggered when remote side closed the socket
        //cleanup internal objects
        //if it was call to local close()/abort() the objects are cleaned up already

        QAndroidJniEnvironment env;
        socketObject.callMethod<void>("close");
        if (env->ExceptionCheck()) {
            env->ExceptionDescribe();
            env->ExceptionClear();
        }

        inputStream = outputStream = remoteDevice = socketObject = QAndroidJniObject();
    }

    q->setSocketState(QBluetoothSocket::UnconnectedState);
    q->setOpenMode(QIODevice::NotOpen);
    emit q->disconnected();
}
コード例 #8
0
ファイル: screenvalues.cpp プロジェクト: ivanph/qtworldsummit
int ScreenValues::retrieveDpi()
{
#ifdef Q_OS_ANDROID
    QAndroidJniEnvironment env;
    env->PushLocalFrame(9);

    QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative",
                                                                           "activity",
                                                                           "()Landroid/app/Activity;");

    QAndroidJniObject resources = activity.callObjectMethod("getResources",
                                                            "()Landroid/content/res/Resources;");

    QAndroidJniObject displayMetrics = resources.callObjectMethod("getDisplayMetrics",
                                                                  "()Landroid/util/DisplayMetrics;");

    jint densityDpi = displayMetrics.getField<jint>("densityDpi");

    int result = (int)densityDpi;

    return result;
#else
    return QGuiApplication::primaryScreen()->physicalDotsPerInch();
#endif
}
コード例 #9
0
ファイル: Wpp.cpp プロジェクト: AndrewDesign/wpp-qt
void Wpp::addToImageGallery(const QString& imageFullPath)
{

#if defined(Q_OS_ANDROID)
	/*
	 http://stackoverflow.com/questions/2170214/image-saved-to-sdcard-doesnt-appear-in-androids-gallery-app
	File imageFile = ...
	MediaScannerConnection.scanFile(this, new String[] { imageFile.getPath() }, new String[] { "image/jpeg" }, null);
	 */

	QAndroidJniObject activity = QtAndroid::androidActivity();
	qDebug() << __FUNCTION__ << "activity.isValid()=" << activity.isValid();

	QAndroidJniEnvironment env;

	//new String[] { imageFile.getPath() }
	jobjectArray imageFilePaths = (jobjectArray)env->NewObjectArray(
		1,
		env->FindClass("java/lang/String"),
		(jobject)0
	);
	QAndroidJniObject imagePathJString = QAndroidJniObject::fromString(imageFullPath);
	env->SetObjectArrayElement(
		imageFilePaths, 0, imagePathJString.object<jstring>() );

	//new String[] { "image/jpeg", "image/png", "image/gif" }
	jobjectArray imageFileTypes = (jobjectArray)env->NewObjectArray(
		3,
		env->FindClass("java/lang/String"),
		(jobject)0
	);
	QAndroidJniObject imageType1 = QAndroidJniObject::fromString("image/jpeg");
	env->SetObjectArrayElement(
		imageFileTypes, 0, imageType1.object<jstring>() );
	QAndroidJniObject imageType2 = QAndroidJniObject::fromString("image/png");
	env->SetObjectArrayElement(
		imageFileTypes, 1, imageType2.object<jstring>() );
	QAndroidJniObject imageType3 = QAndroidJniObject::fromString("image/gif");
	env->SetObjectArrayElement(
		imageFileTypes, 2, imageType3.object<jstring>() );


	QAndroidJniObject::callStaticMethod<void>("android/media/MediaScannerConnection",
											  "scanFile",
											  "(Landroid/content/Context;[Ljava/lang/String;[Ljava/lang/String;Landroid/media/MediaScannerConnection$OnScanCompletedListener;)V",
											  activity.object<jobject>(),
											  imageFilePaths, imageFileTypes, (jobject)0);



	env->DeleteLocalRef(imageFilePaths);
	env->DeleteLocalRef(imageFileTypes);

#else

#endif


}
コード例 #10
0
ファイル: Wpp.cpp プロジェクト: AndrewDesign/wpp-qt
QString Wpp::createAlbumPath(const QString& albumName)
{
	QString parentPath;

#if defined(Q_OS_ANDROID)
	QAndroidJniObject Environment__MEDIA_MOUNTED = QAndroidJniObject::getStaticObjectField(
				"android/os/Environment", "MEDIA_MOUNTED", "Ljava/lang/String;");
	qDebug() << "Environment__MEDIA_MOUNTED:isValid:" << Environment__MEDIA_MOUNTED.isValid() << ":toString:" << Environment__MEDIA_MOUNTED.toString();
	QString  Environment__MEDIA_MOUNTED_STRING =	Environment__MEDIA_MOUNTED.toString();
	QAndroidJniObject mediaState = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageState", "()Ljava/lang/String;");
	QString mediaStateString = mediaState.toString();

	qDebug() <<"mediaStateString:"<< mediaStateString;

	if(mediaStateString != Environment__MEDIA_MOUNTED_STRING )
	{
		qDebug() << "No SD Card...";
		return QString();
	}

		//https://qt-project.org/forums/viewthread/35519
		QAndroidJniObject mediaDir = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
		QAndroidJniObject mediaPath = mediaDir.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" );
		parentPath = mediaPath.toString();
		QAndroidJniEnvironment env;
		if (env->ExceptionCheck()) {
			// Handle exception here.
			qDebug() << "[ERR]:Android(Extras):getting SD card path";
			env->ExceptionClear();
		}
#elif defined(Q_OS_IOS)
		QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
		qDebug() << "[IOS]album parent paths count:" << paths.size();
		parentPath = paths.first();
#else
		QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
		qDebug() << "[Other OS]album parent paths count:" << paths.size();
		parentPath = paths.first();

#endif

		QDir dir(parentPath);

		qDebug() << __FUNCTION__ << ":dir=" << dir.dirName();

		QString userAlbumPath = parentPath.append("/").append(albumName);;
		QDir userAlbumDir = userAlbumPath;
		if( !userAlbumDir.exists() )
		{
			qDebug() << albumName << ":not exists, create it";
			dir.mkpath( albumName );
		}
		else
		{
			qDebug() << albumName << ":exists";
		}

		return userAlbumPath;
}
コード例 #11
0
void cleanJavaException()
{
    QAndroidJniEnvironment env;
    if (env->ExceptionCheck()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
    }
}
コード例 #12
0
void tst_QAndroidJniObject::getStaticByteField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Byte");
    QVERIFY(cls != 0);

    jbyte i = QAndroidJniObject::getStaticField<jbyte>(cls, "MAX_VALUE");
    QCOMPARE(i, jbyte(127));
}
コード例 #13
0
void tst_QAndroidJniObject::getStaticIntField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Double");
    QVERIFY(cls != 0);

    jint i = QAndroidJniObject::getStaticField<jint>(cls, "SIZE");
    QCOMPARE(i, 64);
}
コード例 #14
0
void tst_QAndroidJniObject::getStaticShortField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Short");
    QVERIFY(cls != 0);

    jshort i = QAndroidJniObject::getStaticField<jshort>(cls, "MAX_VALUE");
    QCOMPARE(i, jshort(32767));
}
コード例 #15
0
void QQmlAndroidScrollView::onRegisterNativeMethods(jobject listener)
{
    JNINativeMethod methods[] {{"onScrollChanged", "(JII)V", reinterpret_cast<void *>(onScrollChanged)}};

    QAndroidJniEnvironment env;
    jclass cls = env->GetObjectClass(listener);
    env->RegisterNatives(cls, methods, sizeof(methods) / sizeof(methods[0]));
    env->DeleteLocalRef(cls);
}
コード例 #16
0
void tst_QAndroidJniObject::getStaticCharField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Character");
    QVERIFY(cls != 0);

    jchar i = QAndroidJniObject::getStaticField<jchar>(cls, "MAX_VALUE");
    QCOMPARE(i, jchar(0xffff));
}
コード例 #17
0
void tst_QAndroidJniObject::getStaticLongField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Long");
    QVERIFY(cls != 0);

    jlong i = QAndroidJniObject::getStaticField<jlong>(cls, "MAX_VALUE");
    QCOMPARE(i, jlong(9223372036854775807L));
}
bool exceptionCheck()
{
    /*
      The QAndroidJniEnvironment attaches the current thread to the JavaVM on
      creation and detach when it goes out of scope.
     */
    QAndroidJniEnvironment qjniEnv;
    return qjniEnv->ExceptionCheck();
}
コード例 #19
0
void tst_QAndroidJniObject::getStaticDoubleField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Double");
    QVERIFY(cls != 0);

    jdouble i = QAndroidJniObject::getStaticField<jdouble>(cls, "NaN");
    jlong *k = reinterpret_cast<jlong*>(&i);
    QCOMPARE(*k, jlong(0x7ff8000000000000L));
}
コード例 #20
0
void tst_QAndroidJniObject::getStaticFloatField()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Float");
    QVERIFY(cls != 0);

    jfloat i = QAndroidJniObject::getStaticField<jfloat>(cls, "NaN");
    unsigned *k = reinterpret_cast<unsigned*>(&i);
    QCOMPARE(*k, unsigned(0x7fc00000));
}
コード例 #21
0
qint64 QSerialPortPrivate::writeToPort(const char *data, qint64 maxSize)
{
    if (deviceId == BAD_PORT)
    {
        q_ptr->setError(QSerialPort::NotOpenError);
        return 0;
    }

    QAndroidJniEnvironment jniEnv;
    jbyteArray jarrayL = jniEnv->NewByteArray(maxSize);
    jniEnv->SetByteArrayRegion(jarrayL, 0, maxSize, (jbyte *)data);
    if (jniEnv->ExceptionCheck())
        jniEnv->ExceptionClear();
    int resultL = QAndroidJniObject::callStaticMethod<jint>(
        kJniClassName,
        "write",
        "(I[BI)I",
        deviceId,
        jarrayL,
        internalWriteTimeoutMsec);

    if (jniEnv->ExceptionCheck())
    {
        jniEnv->ExceptionClear();
        q_ptr->setErrorString(QStringLiteral("Writing to the device threw an exception"));
        jniEnv->DeleteLocalRef(jarrayL);
        return 0;
    }
    jniEnv->DeleteLocalRef(jarrayL);
    return resultL;
}
bool aseman_android_loclis_registerNativeMethods() {
    JNINativeMethod methods[] {{"_locationListened", "(DDDLjava/lang/String;)V", reinterpret_cast<void *>(locationListened)}};

    QAndroidJniObject javaClass("land/aseman/android/extra/AsemanLocationListener");
    QAndroidJniEnvironment env;
    jclass objectClass = env->GetObjectClass(javaClass.object<jobject>());

    env->RegisterNatives(objectClass, methods, sizeof(methods) / sizeof(methods[0]));

    env->DeleteLocalRef(objectClass);
    return true;
}
コード例 #23
0
void tst_QAndroidJniObject::callStaticCharMethod()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Character");
    QVERIFY(cls != 0);

    jchar returnValue = QAndroidJniObject::callStaticMethod<jchar>(cls,
                                                            "toUpperCase",
                                                            "(C)C",
                                                            jchar('a'));
    QCOMPARE(returnValue, jchar('A'));
}
コード例 #24
0
void QASystemDispatcher::dispatch(QString name, QVariantMap message)
{
#ifdef Q_OS_ANDROID
    QAndroidJniEnvironment env;
    jstring jName = env->NewStringUTF(name.toLocal8Bit().data());
    jobject jData = createHashMap(message);
    QAndroidJniObject::callStaticMethod<jboolean>(JCLASS_Name, "dispatch",
                                              DISPATCH_SIGNATURE,
                                              jName,jData);

#endif
}
コード例 #25
0
CBSettings::CBSettings(QObject *parent) : QObject(parent),
    settings("settings.ini",QSettings::IniFormat)
{
    settings.setIniCodec("windows-1251");

    if (settings.value(kIsFirstRan,true).toBool()){
        // we have never use settings before,let's init them
        settings.setValue(kIsFirstRan,false);
        settings.setValue(kNeedCollect,true);
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || defined(Q_OS_IOS)
        QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
        if (!paths.empty()){
            settings.setValue(kDefaultPath,"file:///"+paths.at(0)+"/Bases/");
        }
        paths = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation);
        if (!paths.empty()){
            settings.setValue(kAttachSearchPath,"file:///"+paths.at(0)+"/");
        }
#endif

#ifdef  Q_OS_ANDROID

        QAndroidJniObject mediaDir = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
        QAndroidJniObject mediaPath = mediaDir.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" );
        QString dataAbsPath = "file://" + mediaPath.toString();
        settings.setValue(kDefaultPath,dataAbsPath +"/Bases/");
        settings.setValue(kAttachSearchPath,dataAbsPath+"/Downloads/");
        QAndroidJniEnvironment env;
        if (env->ExceptionCheck()) {
                // Handle exception here.
                env->ExceptionClear();
        }
#endif
    }

    lastBasePath = settings.value(kLastBasePath,"").toString();
    needCollect = settings.value(kNeedCollect,false).toBool();
    m_defaultPath = settings.value(kDefaultPath,"").toString();
    m_attachSearchPath = settings.value(kAttachSearchPath,"").toString();

    int size = settings.beginReadArray(kRecent);
    for (int i = 0; i < size; ++i) {
        settings.setArrayIndex(i);
        QString name = settings.value(kBaseName).toString();
        QString path = settings.value(kBasePath).toString();
        recentBasesMap[name] = path;
    }
    settings.endArray();
    emit recentBasesChanged();

}
コード例 #26
0
ファイル: android.cpp プロジェクト: 7modelsan/subsurface
const char *system_default_filename(void)
{
	/* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */
	QAndroidJniObject externalStorage = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
	QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod("getAbsolutePath", "()Ljava/lang/String;");
	QString system_default_filename = externalStorageAbsolute.toString() + "/subsurface.xml";
	QAndroidJniEnvironment env;
	if (env->ExceptionCheck()) {
		// FIXME: Handle exception here.
		env->ExceptionClear();
		return strdup("/sdcard/subsurface.xml");
	}
	return strdup(system_default_filename.toUtf8().data());
}
コード例 #27
0
void Widget::onCaptureImage()
{
#ifdef ANDROID
    QAndroidJniObject::callStaticMethod<void>("an/qt/extendsQtWithJava/ExtendsQtWithJava",
                                       "captureImage");
    QAndroidJniEnvironment env;
    if (env->ExceptionCheck()) {
        // Handle exception here.
        qDebug() << "Widget,onCaptureImage, got exception";
        env->ExceptionDescribe();
        env->ExceptionClear();
    }
#endif
}
コード例 #28
0
void tst_QAndroidJniObject::callStaticDoubleMethod()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Double");
    QVERIFY(cls != 0);

    QString number = QString::number(123.45);
    QAndroidJniObject parameter = QAndroidJniObject::fromString(number);

    jdouble returnValue = QAndroidJniObject::callStaticMethod<jdouble>(cls,
                                                          "parseDouble",
                                                          "(Ljava/lang/String;)D",
                                                          parameter.object<jstring>());
    QCOMPARE(returnValue, number.toDouble());
}
コード例 #29
0
void tst_QAndroidJniObject::callStaticShortMethod()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Short");
    QVERIFY(cls != 0);

    QString number = QString::number(123);
    QAndroidJniObject parameter = QAndroidJniObject::fromString(number);

    jshort returnValue = QAndroidJniObject::callStaticMethod<jshort>(cls,
                                                          "parseShort",
                                                          "(Ljava/lang/String;)S",
                                                          parameter.object<jstring>());
    QCOMPARE(returnValue, number.toShort());
}
コード例 #30
0
void tst_QAndroidJniObject::callStaticLongMethod()
{
    QAndroidJniEnvironment env;
    jclass cls = env->FindClass("java/lang/Long");
    QVERIFY(cls != 0);

    QString number = QString::number(123);
    QAndroidJniObject parameter = QAndroidJniObject::fromString(number);

    jlong returnValue = QAndroidJniObject::callStaticMethod<jlong>(cls,
                                                          "parseLong",
                                                          "(Ljava/lang/String;)J",
                                                          parameter.object<jstring>());
    QCOMPARE(returnValue, jlong(number.toLong()));
}