[Android-development] Build an Android Launcher in Qt ...

Éric Seigne eric.seigne at ryxeo.com
Fri Feb 28 23:16:42 CET 2014


Le 28/02/2014 23:10, David Marceau a écrit :
> On 02/28/2014 04:53 PM, David Marceau wrote:
>> On 02/28/2014 03:44 PM, Éric Seigne wrote:
>>> Hello,
>>>     int receiverRequestCode = -1;
>>>     QAndroidJniObject intent = QAndroidJniObject::callStaticObjectMethod("com/my/app/name_two", "QtActivity","");
>>>     QtAndroid::startActivity(intent, receiverRequestCode, 0);
>>>
>>> but i don't know what i have to use as first and second parameters of 
>>> callStaticObjectMethod function ?
>> https://github.com/omac777/qtsnowloadcount/blob/master/trucktypetotalspage.cpp#L59
>>
>> https://github.com/omac777/qtsnowloadcount/blob/master/trucktypetotalspage.cpp#L72
> I will clarify.  Here is the doc for the method you want to call:
> http://qt-project.org/doc/qt-5/qandroidjniobject.html#callStaticObjectMethod-2
>
> QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(const char *
> className, const char * methodName, const char * signature, ...) [static]
> Calls the static method with methodName and signature on the class
> className.
> QAndroidJniObject thread =
> QAndroidJniObject::callStaticObjectMethod("java/lang/Thread",
> "currentThread", "()Ljava/lang/Thread;");
> QAndroidJniObject string =
> QAndroidJniObject::callStaticObjectMethod("java/lang/String", "valueOf",
> "(I)Ljava/lang/String;", 10);
>
>>>     QAndroidJniObject intent =
> QAndroidJniObject::callStaticObjectMethod("com/my/app/name_two",
> "QtActivity","");
>
> className >>>> "com/my/app/name_two" >>>That's the java android class name
> methodName >>>> QtActivity  >>>That's the java android method you want
> to call from your cpp.
>
> signature >>>That's the JNI signature for the method you are calling.
> http://en.wikipedia.org/wiki/Java_Native_Interface#Mapping_types
>
> To help you more it would be nice to see the java method you are
> actually trying to call and it's original java declaration.  Provide me
> with that and I will build the signature for you.

Hello David,
thanks a lot for helping me, but i'm a Qt/c++ only developper, there is
0 java code lines in app1 or app2 :o)

in other os i just make a qprocess to launch app2 from app1

Éric




More information about the Android-development mailing list