Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QAndroidJniObject::callstaticobjectmethod return empty string
Forum Updated to NodeBB v4.3 + New Features

QAndroidJniObject::callstaticobjectmethod return empty string

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 204 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JRobles
    wrote on last edited by
    #1

    Hello I have this code:

    
    QAndroidJniObject string = QAndroidJniObject::callStaticObjectMethod<jstring>("com/app/utils/MyParams", "getEmpty");
    qDebug() << "stringContent:" << string.toString();
    
    QAndroidJniObject jniParam = QAndroidJniObject::fromString("name" );
     QAndroidJniObject jniParamValue =  QAndroidJniObject::callStaticObjectMethod(
                                "com/app/utils/MyParams" // class name
                                , "getStaticParam" // method name
                                , "Ljava/lang/String;" // signature
                                , jniParam.object<jstring>() );
    
    qDebug() << "param:" << jniParam.toString();
    
    

    on java:

     public static String getStaticParam(String param){
            String realParamName = "Param_ " + param;        
            return realParamName;
        }
    
    
    public static String getEmpty(){
        String realPath = "EMPTY";
        return realPath;
    }
    
    

    When I call the 'getEmpty' method it works ok, console prints 'stringContent:EMTPY' but when I call the second method it always return an empty string, I don't know why.

    I read that maybe I need to add the return type to the function (QAndroidJniObject::callStaticObjectMethod<jstring>) but doing that gives me an error on QT.

    "no matching function for call to 'callStaticObjectMethod'"

    what Im missing?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved