Native WebView from Android on Qt



  • Hello, everyone! I have a problem with using QWebView on Android (it's just not exist). How can I use Native Web View?



  • I use JNI for sending commands (create, attach to main layout, move, resize, load URL) from C code to Java code (QtActivity.java). May be, it's not better way, but another I not found.
    I.e. I created some class at C++ code, named QtAndroidWebView (inheritor QWidget), where I overrides needed functions to manipulate native Web View object through JNI.
    And I use this code to add WebView to main layout:
    @FrameLayout mainLayout = (FrameLayout) findViewById(R.id.content);
    mainLayout.addView(webView, params);@
    But here exists big problem: native webview displayed over all that drawing Qt. And if you open any dialog, then native webview overrides your dialog. For solving this problem I hide webview then it's dialog not activated (QEvent::ActivationChange event).
    In one word, it is very sorrowfully:)



  • Thank you! I will try this variant.




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.