Want to write a simple Anroid VPN app with reverse binding. I did a quick test based on the reverse example.
So I make an attempt for try as (main change in bold) : --------------------------------------- package reverse import ( "Java/android/databinding/DataBindingUtil" "Java/android/os" * "Java/android/net/VpnService"* * gonet "Java/android/net"* * gointent "Java/android/content/Intent"* "Java/android/support/v7/app" gopkg "Java/reverse" rlayout "Java/reverse/R/layout" "Java/reverse/databinding" "Java/reverse/databinding/ActivityMainBinding" ) type MainActivity struct { app.AppCompatActivity binding databinding.ActivityMainBinding } func (a *MainActivity) OnCreate(this gopkg.MainActivity, b os.Bundle) { this.Super().OnCreate(b) db := DataBindingUtil.SetContentView(this, rlayout.Activity_main) a.binding = ActivityMainBinding.Cast(db) a.binding.SetAct(this) * VpnService.Prepare(this)* * a.StartService(gointent.New(this, gonet.VpnService))* } func (a *MainActivity) OnDestroy(this gopkg.MainActivity) { a.binding = nil // break reference cycle this.Super().OnDestroy() } func (a *MainActivity) GetLabel() string { return "Hello from Go!" } ------------------ main change is VpnService.Prepare(this) and a.StartService(gointent.New(this, gonet.VpnService)), which comes from ToyVPN: > > startService(getServiceIntent().setAction(ToyVpnService.ACTION_DISCONNECT)); > private Intent getServiceIntent() { > return new Intent(this, ToyVpnService.class); > } The compiling output is: > ..\reverse\reverse.go:34:29: type net.VpnService is not an expression. Change to a.StartService(gointent.New(this, gonet.VpnService.Class)) also doesn't help For reverse binding, I mainly refer to #16876 <https://github.com/golang/go/issues/16876> Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.