-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Need help] How to use gowebview in a simple gioui example? #16
Comments
Hi, You must define the
That example will open the webview by default, and also will minimize the webview (without destroy) by clicking in the "Back button" (on the navigation bar).
|
Great, you're my saver, thanks to you, I'll give a try. |
@inkeliz , Sorry for bother you agian.
But, do you know any easy way to call these java code from gioui? (It seems that gomobile reverse binding won't work with gioui) |
I never use something like that. But, you can call any Java code from Gio, using JNI, which is how gowebview work. There's a another simple library which will can use as example. You can take a look at https://github.com/Inkeliz/giohyperlink/blob/main/giohyperlink_android.java#L24, which calls Your Java code must be compiled to You can get the Android Activity from the GioView. The GioView is the |
It seems difficult for me, is there any way to resume the webview after clicking "Back" button, I try to resume it, no luck:
|
You can call I think you need to define how the webview will open. I mean, how the user will (re-)open? What action the user must perform to open the webviewer? For instance, if you are using Gio, and you have some button/clickable area, you can do:
Note: In your example the I can't help without understand what should be done to open/close the webviewer. I mean, if it's close, what should the user do to open it? There's a Gio button for that? One basic example, you can use:
It will open the webviewer if the
|
Thanks for your reply. when I click the hello app icon first time, the text "Hello, gowebview" showed 1 second, then the webview showed. But if I remove the "e.Cancel=false" after "log.Println("=========back button second time====")", it will prevent the user to exit the hello app, it's not good experience for users. |
I need to take a look why the webviewer is surviving after the Since it's destroyed, the webview (and everything) must be destroyed too. I'm not sure why it still "active" when you open the app again. 🤔 As a workaround, I think you can do something like:
I think it will work, but I not sure why it's needed. 🤔🤔🤔 |
It's not as difficult as I imaged, I've successfully fixed my problem by adding a function into gowebview: #18
I'm so exciting, sorry for the code format, I'm using horstmann style: https://github.com/forkgo-org/go |
@inkeliz , do you have time to have a look at this problem? |
I'm not using the latest version of Gio. Personally, I use one fork, which is already 2 months old, and I wait some couple of months when breaking chances happens, before migrate.. I'll take a look into it, but I'm working on another project right now. But, far I understand:
I think you should get I suggest, for now, to not get the latest version of Gio, you can set one version by using the hash (go get gioui.org@dc25afd, and go mod also defines the version). Of course, it's not a fix, but workaround. |
You are right, I can lock the gioui revision in go.mod file, then run "go mod tidy", it works now, thank you.
|
For example, compile gioui example app "hello" is very easy:
And I try to modify hello.go:
But it shows errors:
Anyone give me some hint? Thanks
The text was updated successfully, but these errors were encountered: