Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Android: E Qt JAVA : Surface 1 not found!


  • Qt Champions 2016

    as you probably know I wrote some Qt Blogs and developed ‘ekkes Share Example App’ to demo How to share to and from other Apps.
    I run into a problem on Android sharing data from other Apps
    Have defined App as ‘singleInstance’ in Android Manifest, because I only want to use one Instance of my Qt mobile App.

    Reason: some customer apps have a complex Login / Init workflow, so I always want to re-use the App if already running. Also using ‘singleInstance’ if my already running App was opened by another App my App shows exactly the same Page I just worked with and in some scenarios the incoming data should be inserted there.

    Opening my App from other Apps in most cases works perfect:

    • if my App was not started, the app will be started by external Intent. This Intent was delivered via public void onCreate(...)
      of my Qt Activity. I wait until Qt UI was initialized and then process the pending Intent.
    • if my App already was started, the external App comes in via public void onNewIntent(Intent intent) and I can process the Intent to get the data

    Not all Android Apps are goot citizens. There are some Apps out there not using the public void onNewIntent(Intent intent) if my App already was running. They come in via public void onCreate(...) and now Qt comes in trouble because the Activity already was created and started. I’m getting a white screen, App freezes and this Error was logged:

    E Qt JAVA : Surface 1 not found!
    

    only way to go on was to kill the App.

    So I tried to come out of this trap. Inside public void onCreate(...) I verified that the Activity knows that the App was running. Also I tried getIntent() and was able to process the Intent, to receive and save the data. But cannot go on because UI is freezed with white screen.
    Now I tried to call finish() and return. This avoids the white screen, but exits the App.

    Better then freezing ;-)

    I also tried onBackPressed() - but didn’t work.

    Does someone has an idea how to get back the control if public void onCreate(...) of Qt Activity was called a 2nd time ?

    Want to get rid of white screen and surface null error.

    One workaround could be to store the incoming data from Intent into a special folder inside app data and check this after restarting the app again and ask user if the data from last Intent should be used.


Log in to reply