Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QT 5.6 qml and android gallery.
Forum Updated to NodeBB v4.3 + New Features

QT 5.6 qml and android gallery.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k Views 1 Watching
  • 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
    JulienD
    wrote on last edited by JulienD
    #1

    Hello,

    I would like to know if the Android gallery should pop up when I make a c++ call to java through jni?

    void hulk::onipa()
    {
    
        selectedFileName = "#";
        QAndroidJniObject::callStaticMethod<void>("org/me/project/Qtandroidgallery",
                                                  "openAnImage",
                                                  "()V");
    }
    
    

    and the Java file is

        private static Qtandroidgallery m_instance;
    
        public Qtandroidgallery()
        {
            m_instance = this;
        }
    
        static void openAnImage()
        {
            m_instance.dispatchOpenGallery();
        }
        private void dispatchOpenGallery()
        {
            Intent intent = new Intent(Intent.ACTION_PICK);
            intent.setType("*/*");
    
            startActivityForResult(intent, 1);
    
        }
    

    The c++ function is called from QML.

    So, should the gallery show itself when startActivityForResult is called?

    Thanks

    1 Reply Last reply
    0
    • benlauB Offline
      benlauB Offline
      benlau
      Qt Champions 2016
      wrote on last edited by benlau
      #2

      Since you have already written the program. Why don't you just test it by yourself...?

      I don't know will your code works. Generally speaking, it is supposed to start another activity when startActivityForResult is called. However, it will show another dialog if there has multiple choice of activity available.

      But seem that it has missed a parameter in Intent construction in compared with regular example code for picking image in Android.

      Reference: A proven working image picking for Qt in Android:

      quickandroid/ImagePicker.java at master · benlau/quickandroid

      1 Reply Last reply
      1

      • Login

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