Skip to content
Steven Zack edited this page Sep 29, 2018 · 6 revisions

Get started


Preparation

Installation

go get github.com/gofaith/faithdroid

Build & Run your first Faithdroid App

Open file $GOPATH/src/github.com/gofaith/faithdroid/main.go

Rewrite it with following code

package faithdroid

func (a *MainActivity) OnCreate() {
	LinearLayout(a).DeferShow().Size(-2, -2).Append(
		TextView(a).SetId("text").Text("text view"),
		Button(a).Size(-2, -1).Text("change text").OnClick(func() {
			GetTextViewById("text").Text("text changed")
		}))
}

Run command blow:

gomobile bind --target=android -o $GOPATH/src/github.com/gofaith/faithdroid/example-android-project/faithdroid/faithdroid.aar github.com/gofaith/faithdroid

Open this Android project with Android Studio :$GOPATH/src/github.com/gofaith/faithdroid/example-android-project

Then do the same things you do with Android Studio:

  • 1.Build an .apk file

Click menu Build->Build Apk

  • 2.Run

Click the button with "Run" icon

Links

Clone this wiki locally