Scala Meetup on Android
The repo to drive the Scala Meetup on Android.
To make this work you need to ...
- install git, sbt (using macports or brew) and the Android SDK
- you can then clone this repo and checkout the various tags/steps to walk through the tutorial
Step 0: Get something to compile
- create an empty directory and in this directory create a directory called project
- put the android.sbt file into this directory and run
sbt "gen-android android-21 scala.meetup TutorialApp"
- take a look at the files to understand what was generated
- create an avd and start an emulator
sbt android:runand you should see the MainActivity get started
Step 1: Turn it into a Scala app
- delete project/build.scala and add a build.sbt file
- you can then also delete project.properties (one file less to worry about)
src/main/scala/MainActivity.scala(and rename it to a scala file in the process) and delete
MainActivity.scalaand port it to Scala
- add hello_text in
src/main/res/values/strings.xmland reference it in
- (optional - if you want to use EMACS/ensime) put the ensime.sbt file into the project directory and run
sbt android:runagain and you should see the MainActivity to display the changed hello world text
Step 2: Turn it into a Macroid app
- add the macroid dependencies to the build.sbt file (and/or check the macroid-starter repo for the most current version of a/the build.sbt file)
- edit AndroidManifest.xml to include min/targetSdkVersion
- edit MainActivity.scala to show two buttons and the text (and edit strings.xml accordingly)
src/main/res/layout(this is not needed anymore)
sbt android:runagain and you should see the MainActivity to display two buttons. Try them ...