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. QtAndroidExtras Source: Why some functions get QByteArray parameter?
Forum Update on Monday, May 27th 2025

QtAndroidExtras Source: Why some functions get QByteArray parameter?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 476 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.
  • I Offline
    I Offline
    Ibrahim
    wrote on 7 Feb 2017, 22:40 last edited by
    #1

    Hi; I saw some functions like this in qjni.cpp:

    static jclass getCachedClass(const QByteArray &classBinEnc, bool *isCached = 0)
    {
      ...
    }
    
    inline static jclass loadClass(const QByteArray &className, JNIEnv *env, bool binEncoded = false)
    {
      ...
    }
    

    I don't know why this functions get QByteArray parameter for class name? Class name can be QString, std::string or const char*? Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Artmetic
      wrote on 7 Feb 2017, 22:42 last edited by
      #2

      maybe because of many diffrient languages (UTF, WIN-1250 ect.).

      J 1 Reply Last reply 8 Feb 2017, 05:53
      1
      • A Artmetic
        7 Feb 2017, 22:42

        maybe because of many diffrient languages (UTF, WIN-1250 ect.).

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 8 Feb 2017, 05:53 last edited by
        #3

        @Artmetic QString is 16bit Unicode, so it can handle different languages and encodings.
        @Ibrahim I'm not JNI expert, but maybe the reason is that Qt needs to communicate with Java (JRE) and QByteArray is just an array of bytes - quite universal.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1

        1/3

        7 Feb 2017, 22:40

        • Login

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