1
0
mirror of https://github.com/xlab/android-go.git synced 2025-12-23 22:11:00 +02:00
Files
android-go/example/main.go
2016-05-26 03:57:18 +03:00

41 lines
804 B
Go

package main
import (
"log"
"github.com/xlab/android-go/app"
)
func init() {
app.SetLogTag("GolangExample")
}
func main() {
log.Println("NativeActivity has started ^_^")
nativeWindowEvents := make(chan app.NativeWindowEvent)
app.Main(func(a app.NativeActivity) {
a.HandleNativeWindowEvents(nativeWindowEvents)
a.InitDone()
for {
select {
case event := <-a.LifecycleEvents():
switch event.Kind {
case app.OnCreate:
log.Println(event.Kind, "handled")
default:
log.Println(event.Kind, "event ignored")
}
case event := <-nativeWindowEvents:
switch event.Kind {
case app.NativeWindowRedrawNeeded:
a.NativeWindowRedrawDone()
log.Println(event.Kind, "handled")
default:
log.Println(event.Kind, "event ignored")
}
}
}
})
}