Skip to content
epabst edited this page Feb 3, 2012 · 10 revisions

Scala Android Crud

This is a framework for writing Android Apps using Scala that need entity operations (i.e. CRUD). It is open source so that the community can collaborate to enhance it to make it feature-rich, yet simple to use, and enable high productivity in developing Android Apps.

Features

  • ListActivity and Activity implemented for you for each Entity.
    • Menu button support for ListActivity (not yet for Activity)
    • Context menu support for ListActivity
  • SQLite Database auto-generated based on Entity definition in Scala.
  • Backup and Restore using Google Backup Service supported for Entity data.
  • Foreign Keys supported between Entities
    • Default navigation included between them.
    • They are great for narrowing results as well.
  • Generated data supported, with access to existing Entities.
  • Uses Robolectric for unit tests.
  • Uses Scala 2.8 and Maven

Getting Started

  1. Install Android SDK and set the ANDROID_HOME environment variable to where you installed it.
  2. Install giter8
  3. Run:
    g8 epabst/scala-android-crud
  4. Go into the directory that was created.
  5. Run (this prevents errors with maven-buildnumber-plugin):
    git init
  6. Run:
    mvn process-test-classes -Pgenerate-layouts
    It will generate a new AndroidManifest.xml, ./res/values/strings.xml and create files inside of ./res/layout.
  7. Run “mvn idea:idea”, “mvn ecplise:eclipse”, etc. if needed.
  8. To build and install it on an Android device, connect the device or start an emulator instance and then run this command:
    mvn clean package android:deploy

To add additional entities:

  1. Copy the Entity.scala file for each additional entity.
  2. Replace the name references in the new file for each class and set the entityName.
  3. Add the new CrudType to your XXXApplication class.
  4. Run:
    mvn process-test-classes -Pgenerate-layouts
    to regenerate the AndroidManifest.xml, strings.xml, and layout files to include the new entities.
  • We do recommend fixing the directory and file names to match the package and class names.
  • To use the Google Backup Service, add a backup service key to the AndroidManifest.xml.
  • See some sample customizations are exemplified as sequential commits in: demo-of-scala-android-crud.
  • Contact me with any questions. I should respond within 24 hours. I’ll document the answers to my questions for future reference.

More Information

Clone this wiki locally