I haven't used these bindings but wouldn't you rename the v7 import as

sapp "Java/android/support/v7/app"

and then import

"Java/android/app"

then reference `app.AlertDialog` as appropriate? You'll also need to call
`dialog.Show()` in `showDialog`.

On Sat, Dec 24, 2016 at 8:35 AM glenford williams <
glenfordwilli...@gmail.com> wrote:

> thanks that worked.
>
> the basic example works but i tried modifying to show a dialog but got
>
>
> error
>
> /home/kingwill101/go/bin/gomobile: loadExportData failed go install -
> pkgdir=/home/kingwill101/go/pkg/gomobile/pkg_android_386 -tags="" -gcflags
> =-shared -ldflags=-shared gitlab.com/kingwill101/reverse/reverse failed:
> exit status 1
> ../reverse/reverse.go:11:2: cannot find package
> "Java/android/app/AlertDialog" in any of:
>     /usr/local/go/src/Java/android/app/AlertDialog (from $GOROOT)
>     /tmp/gomobile-work-258045397/gen/src/Java/android/app/AlertDialog (
> from $GOPATH)
>     /home/kingwill101/go/src/Java/android/app/AlertDialog
>
>
> code
>
>
> package reverse
>
> import (
>     "Java/android/databinding/DataBindingUtil"
>     "Java/android/os"
>     "Java/android/app/AlertDialog"
>     "Java/android/support/v7/app"
>     rlayout "Java/go/reverse/R/layout"
>     "Java/go/reverse/databinding/ActivityMainBinding"
> )
>
> type MainActivity struct {
>     app.AppCompatActivity
> }
>
> func (a *MainActivity) OnCreate1(this app.AppCompatActivity, b os.Bundle)
> {
>     this.Super().OnCreate1(b)
>     db := DataBindingUtil.SetContentView2(this, rlayout.Activity_main)
>     mainBind := ActivityMainBinding.Cast(db)
>     mainBind.SetAct(this)
>     a.showDialog()
> }
>
> func (a *MainActivity) GetLabel() string {
>     return "Hello from Go!"
> }
>
> func (a *MainActivity) showDialog(){
>     b := AlertDialog().Builder(this.getActivity())
>     b.SetMessage("Dialog test from go").SetTitle("GO!!")
>     dialog :=b.Create()
> }
>
>
>
>
>
>
> On Saturday, 24 December 2016 04:52:22 UTC-5, Elias Naur wrote:
>
> It seems your gobind command is out of date. Update it and gomobile with
>
> go install golang.org/x/mobile/cmd/...
>
>  - elias
>
> --
> 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.
>

-- 
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.

Reply via email to