SlideShare ist ein Scribd-Unternehmen logo
1 von 244
Scala on Androids




           Thor Åge Eldby

           @thoraageeldby
       1
Me
C/C
   ++
                a
             av
            lJ
         na
        so




                                          J2M
         r
      Pe




                                               E
                           Java


                    An
                       dro
                           id
                                  Scala
                                           2
Arktekk


• Started 2007
• Consultancy and training


                     3
Android
Fringe to mainstream




         4
Android 101




     5
Android 101




    Linux



      5
Android 101



OpenCore


               Linux



                 5
Android 101



OpenCore   SQLite


                    Linux



                      5
Android 101



                    OpenGL
OpenCore   SQLite
                      ES


                     Linux



                       5
Android 101



                    OpenGL
OpenCore   SQLite            WebKit
                      ES


                     Linux



                       5
Android 101



                    OpenGL
OpenCore   SQLite            WebKit   Other
                      ES


                     Linux



                       5
Android 101


                    Dalvik


                    OpenGL
OpenCore   SQLite            WebKit   Other
                      ES


                     Linux



                       5
Android 101
 Apache
Harmony


                    Dalvik


                    OpenGL
OpenCore   SQLite            WebKit   Other
                      ES


                     Linux



                       5
Android 101
 Apache
           HttpClient
Harmony


                        Dalvik


                        OpenGL
OpenCore    SQLite               WebKit   Other
                          ES


                         Linux



                           5
Android 101
 Apache
           HttpClient   org.json
Harmony


                        Dalvik


                        OpenGL
OpenCore    SQLite                 WebKit   Other
                          ES


                         Linux



                           5
Android 101
 Apache
           HttpClient   org.json   DOM/SAX
Harmony


                        Dalvik


                        OpenGL
OpenCore    SQLite                  WebKit   Other
                          ES


                         Linux



                           5
Android 101
 Apache
           HttpClient   org.json   DOM/SAX   Android
Harmony


                        Dalvik


                        OpenGL
OpenCore    SQLite                  WebKit   Other
                          ES


                         Linux



                           5
Android SDK
Android SDK
.java
files
Android SDK
.java
files
Android SDK
.java
files



javac
Android SDK
.java
files



javac
Android SDK
.java
files



javac



.class
 files
Android SDK
.java
files



javac



.class
 files
Android SDK
.java
files



javac



.class
 files
           dx
Android SDK
.java
files



javac



.class
 files
           dx
Android SDK
.java
files



javac



.class
 files             .dex
           dx
                   file
Android SDK
.java
files



javac



.class
 files             .dex
           dx
                   file
Android SDK
.java
files



javac



.class
 files             .dex   resou-
           dx
                   file    rces
Android SDK
.java
files



javac



.class
 files             .dex   resou-
           dx
                   file    rces
Android SDK
.java
files



javac
                         aapt

.class
 files             .dex      resou-
           dx
                   file       rces
Android SDK
.java
files



javac
                         aapt

.class
 files             .dex      resou-
           dx
                   file       rces
Android SDK
.java
files                     .apk
                          file

javac
                         aapt

.class
 files             .dex      resou-
           dx
                   file       rces
Android SDK
.java
files                     .apk
                          file

javac
                         aapt

.class
 files             .dex      resou-
           dx
                   file       rces
Android SDK
.java           adb
files                         .apk
                              file

javac
                             aapt

.class
 files                 .dex      resou-
           dx
                       file       rces
Android SDK
.java           adb
files                         .apk
                              file

javac
                             aapt

.class
 files                 .dex      resou-
           dx
                       file       rces
Android SDK
.java           adb
files                         .apk
                              file

javac
                             aapt

.class
 files                 .dex      resou-
           dx
                       file       rces
Android SDK
.java               adb
files                             .apk
                                  file

javac
                                 aapt

.class
 files                     .dex      resou-
           dx
                           file       rces
                6
Android Development
      Components




          7
Android Development
                  Components
   Activity

Text
Text
  Done   Cancel




                      7
Android Development
                  Components
   Activity         Service

Text
Text
  Done   Cancel




                       7
Android Development
                  Components
   Activity         Service    Broadcast-
                                Receiver
Text
Text
  Done   Cancel




                       7
Android Development
                       Components
   Activity              Service    Broadcast-
                                     Receiver
Text
Text
  Done   Cancel



              Intent

                            7
Android Development
                       Components
   Activity              Service    Broadcast-
                                     Receiver
Text
Text
  Done   Cancel



              Intent

                            7
Android Development
                       Components
   Activity              Service    Broadcast-
                                     Receiver
Text
Text
  Done   Cancel



              Intent

                            7
Littlebro
http://github.com/thoraage/littlebro-android
http://github.com/thoraage/jmx-rest-access




                     8
Overview
  Android
  Littlebro




      9
Overview
   Android
   Littlebro


  Jetty / LIFT
JMX REST Access




       9
Overview
   Android
   Littlebro


  Jetty / LIFT
JMX REST Access


   Glassfish
     JMX
       9
Demo




 10
SBT


• http://code.google.com/p/simple-build-tool/


                     11
SBT

• Command line
• Maven source structure
• Configured in Scala

                    12
SBT Structure
|-- project
| |-- build
| | `-- Littlebro.scala
| |-- build.properties
| `-- plugins
|    `-- Plugins.scala



                          13
SBT Structure
|-- project
| |-- build
| | `-- Littlebro.scala
| |-- build.properties
| `-- plugins
|    `-- Plugins.scala



                          13
SBT Structure
|-- project
| |-- build
| | `-- Littlebro.scala
| |-- build.properties
| `-- plugins
|    `-- Plugins.scala



                          13
SBT Structure
|-- project
| |-- build
| | `-- Littlebro.scala
| |-- build.properties
| `-- plugins
|    `-- Plugins.scala



                          13
Scala 101
                   Traits
trait A { def a = "aaa" }
trait B { def b = "bbb" }




                            14
Scala 101
                   Traits
trait A { def a = "aaa" }
trait B { def b = "bbb" }




class C extends A with B {
  def c = "ccc"
}




                             14
Scala 101
                   Traits
trait A { def a = "aaa" }
trait B { def b = "bbb" }




class C extends A with B {
  def c = "ccc"
}


val c = new C
println(c.a + c.b + c.c)




                             14
Scala 101
                   Traits
trait A { def a = "aaa" }
trait B { def b = "bbb" }




class C extends A with B {
  def c = "ccc"
}


val c = new C
println(c.a + c.b + c.c)




                             14
Scala 101
                   Traits
trait A { def a = "aaa" }
trait B { def b = "bbb" }




class C extends A with B {
  def c = "ccc"
}


val c = new C
println(c.a + c.b + c.c)          aaabbbccc


                             14
Project

class Littlebro(info: ProjectInfo)
  extends AndroidProject(info)
    with TypedResources
      with Eclipsify {

    override def androidPlatformName = "android-1.5"

}




                          15
Project

class Littlebro(info: ProjectInfo)
  extends AndroidProject(info)
    with TypedResources
      with Eclipsify {

    override def androidPlatformName = "android-1.5"

}




                          15
Project

class Littlebro(info: ProjectInfo)
  extends AndroidProject(info)
    with TypedResources
      with Eclipsify {

    override def androidPlatformName = "android-1.5"

}




                          15
Project

class Littlebro(info: ProjectInfo)
  extends AndroidProject(info)
    with TypedResources
      with Eclipsify {

    override def androidPlatformName = "android-1.5"

}




                          15
SBT & Android
• http://github.com/jberkel/android-plugin




                     16
SBT & Android
  • http://github.com/jberkel/android-plugin
scalac




                       16
SBT & Android
  • http://github.com/jberkel/android-plugin
scalac




                       16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files



                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files



                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files

           ProGuard

                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files

           ProGuard

                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files                       less
                           .class
           ProGuard         files

                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files                       less
                           .class
           ProGuard         files

                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files                       less
                           .class
           ProGuard         files            dx
                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac


.class
 files                       less
                           .class
           ProGuard         files            dx
                          16
SBT & Android
     • http://github.com/jberkel/android-plugin
  scalac

                                                  ...
.class
 files                       less
                           .class
           ProGuard         files            dx
                          16
Demo




 17
SBT & Idea

• http://github.com/mpeltonen/sbt-idea-plugin
• Hacked to work with sbt-android-plugin:
  http://github.com/thoraage/sbt-idea-plugin
• Generates project files
• SBT processor

                     18
SBT & Eclipse


• http://github.com/musk/SbtEclipsify
• Not tested with Android


                     19
Scala on Androids
      Quick wins




          20
Resources
Resource xml’s and R.java




           21
Layout definition

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
              ...>
  <TextView a:text="@string/host_address_text" .../>
  <EditText a:id="@+id/hostAddress" .../>
  <Button a:id="@+id/login"
          a:text="@string/login_button_text" .../>
</LinearLayout>




                                 22
Layout definition

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
              ...>
  <TextView a:text="@string/host_address_text" .../>
  <EditText a:id="@+id/hostAddress" .../>
  <Button a:id="@+id/login"
          a:text="@string/login_button_text" .../>
</LinearLayout>




                                 22
R.java

public final class R {
    ...
    public static final class id {
        public static final int login=0x7f050001;
    }
    ...
    public static final class string {
        public static final int login_button_text=0x7f040003;
    }
}




                              23
R.java

public final class R {
    ...
    public static final class id {
        public static final int login=0x7f050001;
    }
    ...
    public static final class string {
        public static final int login_button_text=0x7f040003;
    }
}




                              23
R.java

public final class R {
    ...
    public static final class id {
        public static final int login=0x7f050001;
    }
    ...
    public static final class string {
        public static final int login_button_text=0x7f040003;
    }
}




                              23
R.java
                                           Button?
public final class R {
    ...
    public static final class id {
        public static final int login=0x7f050001;
    }
    ...
    public static final class string {
        public static final int login_button_text=0x7f040003;
    }
}




                              23
R.java

public final class R {
    ...
    public static final class id {
        public static final int login=0x7f050001;
    }
    ...
    public static final class string {
        public static final int login_button_text=0x7f040003;
    }
}




                              23
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




                              24
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




                              24
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




                              24
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




• In Scala
  •   val login = findViewById(R.id.login).asInstanceOf[Button]




                              24
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




• In Scala
  •   val login = findViewById(R.id.login).asInstanceOf[Button]




                              24
R.java usage

• In java
  •   Button login = (Button) findViewById(R.id.login);




• In Scala
  •   val login = findViewById(R.id.login).asInstanceOf[Button]




                              24
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.scala
   ...
object TR {
  val login = TypedResource[android.widget.Button](R.id.login)
}
...
trait TypedActivityHolder {
  def activity: Activity
  def findView[T](tr: TypedResource[T]) =
    activity.findViewById(tr.id).asInstanceOf[T]
}
trait TypedActivity extends Activity with TypedActivityHolder {
  def activity = this
}




                               25
TR.java usage


• With TR.scala
 •   val login = findView(TR.login)




                         26
Listeners



    27
Listeners
login.setOnClickListener(new View.OnClickListener() {
  public void onClick(View view) {
    ...
  }
}




                          28
Listeners
login.setOnClickListener(new View.OnClickListener() {
  public void onClick(View view) {
    ...
  }
}

login.setOnClickListener(new View.OnClickListener() {
   override def onClick(view: View) {
     ...
   }
})




                          28
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }


printer.printSome(_.contains("o"))




                           29
Scala 101
  Anonymous functions
class Printer[A](list: List[A]) {
  def printSome(p: A => Boolean): Unit =
    for (elem <- list)
      if (p(elem))
        println(elem.toString)
}


val printer = new Printer(List("yo", "doh", "hi"))
printer.printSome { e => e.contains("o") }


printer.printSome(_.contains("o"))




                           29
Listeners
def onClick(f: View => Unit) {
  setOnClickListener(new View.OnClickListener {
     override def onClick(v: View) = f(v)
  })
}




                           30
Listeners
def onClick(f: View => Unit) {
  setOnClickListener(new View.OnClickListener {
     override def onClick(v: View) = f(v)
  })
}




                           30
Listeners
def onClick(f: View => Unit) {
  setOnClickListener(new View.OnClickListener {
     override def onClick(v: View) = f(v)
  })
}




                           30
Listeners
def onClick(f: View => Unit) {
  setOnClickListener(new View.OnClickListener {
     override def onClick(v: View) = f(v)
  })
}




login.onClick { view => ... }




                           30
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)




                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)


"yodude".rot13



                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)


"yodude".rot13



                           31
Scala 101
      Implicit conversion
class AmendedString(s: String) {
  def rot13 = new String(for (c <- s) yield rotC(c))
  def rotC(c: Char) =
    (((c - 97) + 13) % 26 + 97).asInstanceOf[Char]
}

new AmendedString("yodude").rot13

implicit def string2amendedString(s: String) =
  new AmendedString(s)


"yodude".rot13             lbqhqr

                           31
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)




                           32
Listeners
class AmendedView(view: View) {
  def onClick(f: View => Unit) {
    view.setOnClickListener(new View.OnClickListener {
       override def onClick(v: View) = f(v)
    })
  }
}


implicit def view2AmendedView(view: View) =
  new AmendedView(view)



login.onClick { view => ... }



                           32
Concurrency



     33
Responsiveness
• Separate work and GUI
  GUI thread




                   34
Responsiveness
• Separate work and GUI
  GUI thread




                   34
Responsiveness
 GUI thread                  worker


              Start worker




                 35
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness

new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
  }
}.execute()




                            36
Responsiveness
 GUI thread                    worker


                Start worker




              Update GUI




                   37
Responsiveness

runOnUiThread(new Runnable() {
   def run: Unit = {
     ... update GUI
   }
})




                           38
Responsiveness

runOnUiThread(new Runnable() {
   def run: Unit = {
     ... update GUI
   }
})




                           38
Responsiveness

runOnUiThread(new Runnable() {
   def run: Unit = {
     ... update GUI
   }
})




                           38
Responsiveness

runOnUiThread(new Runnable() {
   def run: Unit = {
     ... update GUI
   }
})




                           38
Responsiveness

runOnUiThread(new Runnable() {
   def run: Unit = {
     ... update GUI
   }
})




                           38
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    runOnUiThread(new Runnable() {
       def run: Unit = {
         ... update GUI
      }
    })
  }
}.execute()




                            39
Responsiveness
new AsyncTask[Object, Void, Object]() {
  override def doInBackground(objects: Object*): Object = {
    ... do hard work
    onUiThread {

       ... update GUI

   }
  }
}.execute()




                            40
Responsiveness
asyncTask {

    ... do hard work
    onUiThread {

        ... update GUI

    }

}




                         41
Further



   42
Actors
Organizing with asynchronous message passing




                     43
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}




                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}

MyActor ! "Yo dude"



                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}

MyActor ! "Yo dude"



                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}

MyActor ! "Yo dude"



                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}

MyActor ! "Yo dude"



                           44
Scala 101
                  Actors
object MyActor extends Actor {
  def act {
    loop {
      react {
        case msg:String => println(msg)
        case other => println("Say what")
      }
    }
  }
  start
}

MyActor ! "Yo dude"              Yo dude

                           44
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors
GUI                     Connection                  Model Factory                    ViewStack


       href, (xml, error)

      httperror, none                xml, (model, error)

                   xmlerror, none                                   model, (model)

                                model, none




                                            45
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actors

case class Routing(success: Option[Actor],
                   failure: Option[Actor])
case class HttpRequestMsg(href: URL, routing: Routing)


retrieveData.onClick {
  Connection ! new HttpRequestMsg(
    "http://s.no/dig/url",
    new Routing(Some(ModelFactory), Some(GUI)))
}




                           46
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Actor
      object Connection extends Actor {
    def retrieve(href: String): Either[Node, Failure] =
       Right(new Failure())
    def act {
       loop {
         react {
           case HttpRequestMsg(href, Routing(success, failure)) =>
              retrieve(href) match {
                case Left(node) => success.map(_ ! node)
                case Right(error) => failure.map(_ ! error)
             }
           case _ => println("Say what")
         }
       }
    }
    start
}


                                   47
Androids on Scala




                 Fini

            @thoraageeldby
       48

Weitere ähnliche Inhalte

Was ist angesagt?

Lean and Kanban Principles for Software Developers
Lean and Kanban Principles for Software DevelopersLean and Kanban Principles for Software Developers
Lean and Kanban Principles for Software DevelopersCory Foy
 
Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Testbells
 
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILMobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILRon Gershinsky
 
Android reverse engineering: understanding third-party applications. OWASP EU...
Android reverse engineering: understanding third-party applications. OWASP EU...Android reverse engineering: understanding third-party applications. OWASP EU...
Android reverse engineering: understanding third-party applications. OWASP EU...Internet Security Auditors
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development KitPeter R. Egli
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsCommonsWare
 
New York Kubernetes: CI/CD Patterns for Kubernetes
New York Kubernetes: CI/CD Patterns for KubernetesNew York Kubernetes: CI/CD Patterns for Kubernetes
New York Kubernetes: CI/CD Patterns for KubernetesAndrew Phillips
 
Build Trust in Your Build-to-Deployment Flow!
Build Trust in Your Build-to-Deployment Flow!Build Trust in Your Build-to-Deployment Flow!
Build Trust in Your Build-to-Deployment Flow!Baruch Sadogursky
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for androidAdrian Mikeliunas
 
Agile - Iteration 0 CodeMash 2010
Agile - Iteration 0 CodeMash 2010Agile - Iteration 0 CodeMash 2010
Agile - Iteration 0 CodeMash 2010kensipe
 
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Sigma Software
 
What's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.xWhat's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.xGeertjan Wielenga
 
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil BartlettAndroid and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlettmfrancis
 

Was ist angesagt? (20)

Advanced CDI in live coding
Advanced CDI in live codingAdvanced CDI in live coding
Advanced CDI in live coding
 
Lean and Kanban Principles for Software Developers
Lean and Kanban Principles for Software DevelopersLean and Kanban Principles for Software Developers
Lean and Kanban Principles for Software Developers
 
Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3
 
CDI In Real Life
CDI In Real LifeCDI In Real Life
CDI In Real Life
 
Xcode 6 release_notes
Xcode 6 release_notesXcode 6 release_notes
Xcode 6 release_notes
 
CDI 1.1 university
CDI 1.1 universityCDI 1.1 university
CDI 1.1 university
 
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILMobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
 
Android reverse engineering: understanding third-party applications. OWASP EU...
Android reverse engineering: understanding third-party applications. OWASP EU...Android reverse engineering: understanding third-party applications. OWASP EU...
Android reverse engineering: understanding third-party applications. OWASP EU...
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development Kit
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and Tactics
 
New York Kubernetes: CI/CD Patterns for Kubernetes
New York Kubernetes: CI/CD Patterns for KubernetesNew York Kubernetes: CI/CD Patterns for Kubernetes
New York Kubernetes: CI/CD Patterns for Kubernetes
 
Build Trust in Your Build-to-Deployment Flow!
Build Trust in Your Build-to-Deployment Flow!Build Trust in Your Build-to-Deployment Flow!
Build Trust in Your Build-to-Deployment Flow!
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for android
 
Agile - Iteration 0 CodeMash 2010
Agile - Iteration 0 CodeMash 2010Agile - Iteration 0 CodeMash 2010
Agile - Iteration 0 CodeMash 2010
 
Integreation
IntegreationIntegreation
Integreation
 
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
 
What's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.xWhat's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.x
 
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil BartlettAndroid and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
 

Andere mochten auch

Presentatie cah 120213pptx
Presentatie cah 120213pptxPresentatie cah 120213pptx
Presentatie cah 120213pptxElse Boutkan
 
Presentation for Young Leaders League Utrecht University on campaigning for s...
Presentation for Young Leaders League Utrecht University on campaigning for s...Presentation for Young Leaders League Utrecht University on campaigning for s...
Presentation for Young Leaders League Utrecht University on campaigning for s...Else Boutkan
 
Presentatie workshops 'Down to One Earth' Haagse Hogeschool
Presentatie workshops 'Down to One Earth' Haagse HogeschoolPresentatie workshops 'Down to One Earth' Haagse Hogeschool
Presentatie workshops 'Down to One Earth' Haagse HogeschoolElse Boutkan
 
Rimantas Simaitis "Ict Teisineje Praktikoje"
Rimantas Simaitis "Ict Teisineje Praktikoje"Rimantas Simaitis "Ict Teisineje Praktikoje"
Rimantas Simaitis "Ict Teisineje Praktikoje"INFOLEX
 
Formatiranje Fontova
Formatiranje FontovaFormatiranje Fontova
Formatiranje Fontovavesnavesna190
 

Andere mochten auch (6)

Presentatie cah 120213pptx
Presentatie cah 120213pptxPresentatie cah 120213pptx
Presentatie cah 120213pptx
 
Presentation for Young Leaders League Utrecht University on campaigning for s...
Presentation for Young Leaders League Utrecht University on campaigning for s...Presentation for Young Leaders League Utrecht University on campaigning for s...
Presentation for Young Leaders League Utrecht University on campaigning for s...
 
Gradle
GradleGradle
Gradle
 
Presentatie workshops 'Down to One Earth' Haagse Hogeschool
Presentatie workshops 'Down to One Earth' Haagse HogeschoolPresentatie workshops 'Down to One Earth' Haagse Hogeschool
Presentatie workshops 'Down to One Earth' Haagse Hogeschool
 
Rimantas Simaitis "Ict Teisineje Praktikoje"
Rimantas Simaitis "Ict Teisineje Praktikoje"Rimantas Simaitis "Ict Teisineje Praktikoje"
Rimantas Simaitis "Ict Teisineje Praktikoje"
 
Formatiranje Fontova
Formatiranje FontovaFormatiranje Fontova
Formatiranje Fontova
 

Ähnlich wie Scala on androids

Intro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler JewellIntro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler Jewelljwi11iams
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Androidcoolmirza143
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introductionaswapnal
 
What Java Programmers Should Learn in 2022.pdf
What Java Programmers Should Learn in 2022.pdfWhat Java Programmers Should Learn in 2022.pdf
What Java Programmers Should Learn in 2022.pdfSeven mentor
 
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.tdc-globalcode
 
Java compilation
Java compilationJava compilation
Java compilationMike Kucera
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual StudioRed Hat Developers
 
How to Dockerize Your .NET Core API
How to Dockerize Your .NET Core APIHow to Dockerize Your .NET Core API
How to Dockerize Your .NET Core APILakshman S
 
whats-new-netbeans-ide-7x.pptx
whats-new-netbeans-ide-7x.pptxwhats-new-netbeans-ide-7x.pptx
whats-new-netbeans-ide-7x.pptxGabrielSoche
 
005528214.pdf
005528214.pdf005528214.pdf
005528214.pdfEidTahir
 
Android and its feature
Android and its featureAndroid and its feature
Android and its featureShubham Kumar
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」Satoshi Goto
 
Android_Studio_Structure.docx
Android_Studio_Structure.docxAndroid_Studio_Structure.docx
Android_Studio_Structure.docxKNANTHINIMCA
 
ReactJS Vs React Native: Understanding Differences, Advantages, Disadvantages
ReactJS Vs React Native: Understanding Differences, Advantages, DisadvantagesReactJS Vs React Native: Understanding Differences, Advantages, Disadvantages
ReactJS Vs React Native: Understanding Differences, Advantages, DisadvantagesTechtic Solutions
 
2011 android
2011 android2011 android
2011 androidvpedapolu
 
Android introduction
Android introductionAndroid introduction
Android introductionRahul Pola
 

Ähnlich wie Scala on androids (20)

Intro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler JewellIntro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler Jewell
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Android
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
What Java Programmers Should Learn in 2022.pdf
What Java Programmers Should Learn in 2022.pdfWhat Java Programmers Should Learn in 2022.pdf
What Java Programmers Should Learn in 2022.pdf
 
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
 
Java compilation
Java compilationJava compilation
Java compilation
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual Studio
 
How to Dockerize Your .NET Core API
How to Dockerize Your .NET Core APIHow to Dockerize Your .NET Core API
How to Dockerize Your .NET Core API
 
whats-new-netbeans-ide-7x.pptx
whats-new-netbeans-ide-7x.pptxwhats-new-netbeans-ide-7x.pptx
whats-new-netbeans-ide-7x.pptx
 
005528214.pdf
005528214.pdf005528214.pdf
005528214.pdf
 
Android and its feature
Android and its featureAndroid and its feature
Android and its feature
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」
 
Android_Studio_Structure.docx
Android_Studio_Structure.docxAndroid_Studio_Structure.docx
Android_Studio_Structure.docx
 
ReactJS Vs React Native: Understanding Differences, Advantages, Disadvantages
ReactJS Vs React Native: Understanding Differences, Advantages, DisadvantagesReactJS Vs React Native: Understanding Differences, Advantages, Disadvantages
ReactJS Vs React Native: Understanding Differences, Advantages, Disadvantages
 
2011 android
2011 android2011 android
2011 android
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
DevNation
DevNation DevNation
DevNation
 
Android introduction
Android introductionAndroid introduction
Android introduction
 

Kürzlich hochgeladen

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Kürzlich hochgeladen (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

Scala on androids

  • 1. Scala on Androids Thor Åge Eldby @thoraageeldby 1
  • 2. Me C/C ++ a av lJ na so J2M r Pe E Java An dro id Scala 2
  • 3. Arktekk • Started 2007 • Consultancy and training 3
  • 6. Android 101 Linux 5
  • 8. Android 101 OpenCore SQLite Linux 5
  • 9. Android 101 OpenGL OpenCore SQLite ES Linux 5
  • 10. Android 101 OpenGL OpenCore SQLite WebKit ES Linux 5
  • 11. Android 101 OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 12. Android 101 Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 13. Android 101 Apache Harmony Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 14. Android 101 Apache HttpClient Harmony Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 15. Android 101 Apache HttpClient org.json Harmony Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 16. Android 101 Apache HttpClient org.json DOM/SAX Harmony Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 17. Android 101 Apache HttpClient org.json DOM/SAX Android Harmony Dalvik OpenGL OpenCore SQLite WebKit Other ES Linux 5
  • 29. Android SDK .java files javac .class files .dex resou- dx file rces
  • 30. Android SDK .java files javac .class files .dex resou- dx file rces
  • 31. Android SDK .java files javac aapt .class files .dex resou- dx file rces
  • 32. Android SDK .java files javac aapt .class files .dex resou- dx file rces
  • 33. Android SDK .java files .apk file javac aapt .class files .dex resou- dx file rces
  • 34. Android SDK .java files .apk file javac aapt .class files .dex resou- dx file rces
  • 35. Android SDK .java adb files .apk file javac aapt .class files .dex resou- dx file rces
  • 36. Android SDK .java adb files .apk file javac aapt .class files .dex resou- dx file rces
  • 37. Android SDK .java adb files .apk file javac aapt .class files .dex resou- dx file rces
  • 38. Android SDK .java adb files .apk file javac aapt .class files .dex resou- dx file rces 6
  • 39. Android Development Components 7
  • 40. Android Development Components Activity Text Text Done Cancel 7
  • 41. Android Development Components Activity Service Text Text Done Cancel 7
  • 42. Android Development Components Activity Service Broadcast- Receiver Text Text Done Cancel 7
  • 43. Android Development Components Activity Service Broadcast- Receiver Text Text Done Cancel Intent 7
  • 44. Android Development Components Activity Service Broadcast- Receiver Text Text Done Cancel Intent 7
  • 45. Android Development Components Activity Service Broadcast- Receiver Text Text Done Cancel Intent 7
  • 47. Overview Android Littlebro 9
  • 48. Overview Android Littlebro Jetty / LIFT JMX REST Access 9
  • 49. Overview Android Littlebro Jetty / LIFT JMX REST Access Glassfish JMX 9
  • 52. SBT • Command line • Maven source structure • Configured in Scala 12
  • 53. SBT Structure |-- project | |-- build | | `-- Littlebro.scala | |-- build.properties | `-- plugins | `-- Plugins.scala 13
  • 54. SBT Structure |-- project | |-- build | | `-- Littlebro.scala | |-- build.properties | `-- plugins | `-- Plugins.scala 13
  • 55. SBT Structure |-- project | |-- build | | `-- Littlebro.scala | |-- build.properties | `-- plugins | `-- Plugins.scala 13
  • 56. SBT Structure |-- project | |-- build | | `-- Littlebro.scala | |-- build.properties | `-- plugins | `-- Plugins.scala 13
  • 57. Scala 101 Traits trait A { def a = "aaa" } trait B { def b = "bbb" } 14
  • 58. Scala 101 Traits trait A { def a = "aaa" } trait B { def b = "bbb" } class C extends A with B { def c = "ccc" } 14
  • 59. Scala 101 Traits trait A { def a = "aaa" } trait B { def b = "bbb" } class C extends A with B { def c = "ccc" } val c = new C println(c.a + c.b + c.c) 14
  • 60. Scala 101 Traits trait A { def a = "aaa" } trait B { def b = "bbb" } class C extends A with B { def c = "ccc" } val c = new C println(c.a + c.b + c.c) 14
  • 61. Scala 101 Traits trait A { def a = "aaa" } trait B { def b = "bbb" } class C extends A with B { def c = "ccc" } val c = new C println(c.a + c.b + c.c) aaabbbccc 14
  • 62. Project class Littlebro(info: ProjectInfo) extends AndroidProject(info) with TypedResources with Eclipsify { override def androidPlatformName = "android-1.5" } 15
  • 63. Project class Littlebro(info: ProjectInfo) extends AndroidProject(info) with TypedResources with Eclipsify { override def androidPlatformName = "android-1.5" } 15
  • 64. Project class Littlebro(info: ProjectInfo) extends AndroidProject(info) with TypedResources with Eclipsify { override def androidPlatformName = "android-1.5" } 15
  • 65. Project class Littlebro(info: ProjectInfo) extends AndroidProject(info) with TypedResources with Eclipsify { override def androidPlatformName = "android-1.5" } 15
  • 66. SBT & Android • http://github.com/jberkel/android-plugin 16
  • 67. SBT & Android • http://github.com/jberkel/android-plugin scalac 16
  • 68. SBT & Android • http://github.com/jberkel/android-plugin scalac 16
  • 69. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files 16
  • 70. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files 16
  • 71. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files ProGuard 16
  • 72. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files ProGuard 16
  • 73. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files less .class ProGuard files 16
  • 74. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files less .class ProGuard files 16
  • 75. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files less .class ProGuard files dx 16
  • 76. SBT & Android • http://github.com/jberkel/android-plugin scalac .class files less .class ProGuard files dx 16
  • 77. SBT & Android • http://github.com/jberkel/android-plugin scalac ... .class files less .class ProGuard files dx 16
  • 79. SBT & Idea • http://github.com/mpeltonen/sbt-idea-plugin • Hacked to work with sbt-android-plugin: http://github.com/thoraage/sbt-idea-plugin • Generates project files • SBT processor 18
  • 80. SBT & Eclipse • http://github.com/musk/SbtEclipsify • Not tested with Android 19
  • 81. Scala on Androids Quick wins 20
  • 83. Layout definition <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" ...> <TextView a:text="@string/host_address_text" .../> <EditText a:id="@+id/hostAddress" .../> <Button a:id="@+id/login" a:text="@string/login_button_text" .../> </LinearLayout> 22
  • 84. Layout definition <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" ...> <TextView a:text="@string/host_address_text" .../> <EditText a:id="@+id/hostAddress" .../> <Button a:id="@+id/login" a:text="@string/login_button_text" .../> </LinearLayout> 22
  • 85. R.java public final class R { ... public static final class id { public static final int login=0x7f050001; } ... public static final class string { public static final int login_button_text=0x7f040003; } } 23
  • 86. R.java public final class R { ... public static final class id { public static final int login=0x7f050001; } ... public static final class string { public static final int login_button_text=0x7f040003; } } 23
  • 87. R.java public final class R { ... public static final class id { public static final int login=0x7f050001; } ... public static final class string { public static final int login_button_text=0x7f040003; } } 23
  • 88. R.java Button? public final class R { ... public static final class id { public static final int login=0x7f050001; } ... public static final class string { public static final int login_button_text=0x7f040003; } } 23
  • 89. R.java public final class R { ... public static final class id { public static final int login=0x7f050001; } ... public static final class string { public static final int login_button_text=0x7f040003; } } 23
  • 90. R.java usage • In java • Button login = (Button) findViewById(R.id.login); 24
  • 91. R.java usage • In java • Button login = (Button) findViewById(R.id.login); 24
  • 92. R.java usage • In java • Button login = (Button) findViewById(R.id.login); 24
  • 93. R.java usage • In java • Button login = (Button) findViewById(R.id.login); • In Scala • val login = findViewById(R.id.login).asInstanceOf[Button] 24
  • 94. R.java usage • In java • Button login = (Button) findViewById(R.id.login); • In Scala • val login = findViewById(R.id.login).asInstanceOf[Button] 24
  • 95. R.java usage • In java • Button login = (Button) findViewById(R.id.login); • In Scala • val login = findViewById(R.id.login).asInstanceOf[Button] 24
  • 96. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 97. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 98. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 99. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 100. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 101. TR.scala ... object TR { val login = TypedResource[android.widget.Button](R.id.login) } ... trait TypedActivityHolder { def activity: Activity def findView[T](tr: TypedResource[T]) = activity.findViewById(tr.id).asInstanceOf[T] } trait TypedActivity extends Activity with TypedActivityHolder { def activity = this } 25
  • 102. TR.java usage • With TR.scala • val login = findView(TR.login) 26
  • 103. Listeners 27
  • 104. Listeners login.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { ... } } 28
  • 105. Listeners login.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { ... } } login.setOnClickListener(new View.OnClickListener() { override def onClick(view: View) { ... } }) 28
  • 106. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } 29
  • 107. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } 29
  • 108. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } 29
  • 109. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } 29
  • 110. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } 29
  • 111. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } 29
  • 112. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } 29
  • 113. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } 29
  • 114. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } 29
  • 115. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } 29
  • 116. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } printer.printSome(_.contains("o")) 29
  • 117. Scala 101 Anonymous functions class Printer[A](list: List[A]) { def printSome(p: A => Boolean): Unit = for (elem <- list) if (p(elem)) println(elem.toString) } val printer = new Printer(List("yo", "doh", "hi")) printer.printSome { e => e.contains("o") } printer.printSome(_.contains("o")) 29
  • 118. Listeners def onClick(f: View => Unit) { setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } 30
  • 119. Listeners def onClick(f: View => Unit) { setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } 30
  • 120. Listeners def onClick(f: View => Unit) { setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } 30
  • 121. Listeners def onClick(f: View => Unit) { setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } login.onClick { view => ... } 30
  • 122. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } 31
  • 123. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } 31
  • 124. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } 31
  • 125. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 31
  • 126. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) 31
  • 127. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) 31
  • 128. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) 31
  • 129. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) 31
  • 130. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) "yodude".rot13 31
  • 131. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) "yodude".rot13 31
  • 132. Scala 101 Implicit conversion class AmendedString(s: String) { def rot13 = new String(for (c <- s) yield rotC(c)) def rotC(c: Char) = (((c - 97) + 13) % 26 + 97).asInstanceOf[Char] } new AmendedString("yodude").rot13 implicit def string2amendedString(s: String) = new AmendedString(s) "yodude".rot13 lbqhqr 31
  • 133. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } 32
  • 134. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } 32
  • 135. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } 32
  • 136. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } 32
  • 137. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } 32
  • 138. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) 32
  • 139. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) 32
  • 140. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) 32
  • 141. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) 32
  • 142. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) 32
  • 143. Listeners class AmendedView(view: View) { def onClick(f: View => Unit) { view.setOnClickListener(new View.OnClickListener { override def onClick(v: View) = f(v) }) } } implicit def view2AmendedView(view: View) = new AmendedView(view) login.onClick { view => ... } 32
  • 144. Concurrency 33
  • 145. Responsiveness • Separate work and GUI GUI thread 34
  • 146. Responsiveness • Separate work and GUI GUI thread 34
  • 147. Responsiveness GUI thread worker Start worker 35
  • 148. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 149. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 150. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 151. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 152. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 153. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work } }.execute() 36
  • 154. Responsiveness GUI thread worker Start worker Update GUI 37
  • 155. Responsiveness runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) 38
  • 156. Responsiveness runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) 38
  • 157. Responsiveness runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) 38
  • 158. Responsiveness runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) 38
  • 159. Responsiveness runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) 38
  • 160. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 161. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 162. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 163. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 164. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 165. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 166. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 167. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 168. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work runOnUiThread(new Runnable() { def run: Unit = { ... update GUI } }) } }.execute() 39
  • 169. Responsiveness new AsyncTask[Object, Void, Object]() { override def doInBackground(objects: Object*): Object = { ... do hard work onUiThread { ... update GUI } } }.execute() 40
  • 170. Responsiveness asyncTask { ... do hard work onUiThread { ... update GUI } } 41
  • 171. Further 42
  • 172. Actors Organizing with asynchronous message passing 43
  • 173. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 174. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 175. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 176. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 177. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 178. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 179. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 180. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 181. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 182. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 183. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 184. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 185. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 186. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } 44
  • 187. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } MyActor ! "Yo dude" 44
  • 188. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } MyActor ! "Yo dude" 44
  • 189. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } MyActor ! "Yo dude" 44
  • 190. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } MyActor ! "Yo dude" 44
  • 191. Scala 101 Actors object MyActor extends Actor { def act { loop { react { case msg:String => println(msg) case other => println("Say what") } } } start } MyActor ! "Yo dude" Yo dude 44
  • 192. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 193. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 194. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 195. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 196. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 197. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 198. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 199. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 200. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 201. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 202. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 203. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 204. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 205. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 206. Actors GUI Connection Model Factory ViewStack href, (xml, error) httperror, none xml, (model, error) xmlerror, none model, (model) model, none 45
  • 207. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 208. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 209. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 210. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 211. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 212. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 213. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 214. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 215. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 216. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 217. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) 46
  • 218. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 219. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 220. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 221. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 222. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 223. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 224. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 225. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 226. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 227. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 228. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 229. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 230. Actors case class Routing(success: Option[Actor], failure: Option[Actor]) case class HttpRequestMsg(href: URL, routing: Routing) retrieveData.onClick { Connection ! new HttpRequestMsg( "http://s.no/dig/url", new Routing(Some(ModelFactory), Some(GUI))) } 46
  • 231. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 232. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 233. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 234. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 235. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 236. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 237. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 238. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 239. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 240. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 241. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 242. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 243. Actor object Connection extends Actor { def retrieve(href: String): Either[Node, Failure] = Right(new Failure()) def act { loop { react { case HttpRequestMsg(href, Routing(success, failure)) => retrieve(href) match { case Left(node) => success.map(_ ! node) case Right(error) => failure.map(_ ! error) } case _ => println("Say what") } } } start } 47
  • 244. Androids on Scala Fini @thoraageeldby 48

Hinweis der Redaktion

  1. Fringe: J2ME and Windows Mobile No working market Mainstream: Android and iPhone Android bigger than iPhone GOOGLE Customisable: Open source, Linux Exploding platform Mobile, TV, Pad Specialised devices will come
  2. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  3. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  4. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  5. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  6. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  7. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  8. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  9. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  10. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  11. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  12. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  13. Telephones running UNIX (OpenCore media library) Dalvik ~= JVM Develop in java Harmony - Subset base class library GUI, bluetooth, WiFi, telephony, location, other hardware
  14. Build system Used in Scala-community
  15. build.properties Version, project name, scala version build - project definition plugins - definition of plugins used
  16. build.properties Version, project name, scala version build - project definition plugins - definition of plugins used
  17. build.properties Version, project name, scala version build - project definition plugins - definition of plugins used
  18. ProjectInfo - external properties, paths Eclipsify Eclipse for nice colours
  19. ProjectInfo - external properties, paths Eclipsify Eclipse for nice colours
  20. ProjectInfo - external properties, paths Eclipsify Eclipse for nice colours
  21. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  22. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  23. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  24. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  25. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  26. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  27. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  28. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  29. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  30. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  31. ProGuard Reflection Hello world example -&gt; 5kb Littlebro + 2.7.7 -&gt; 100kb Littlebro + 2.8.0 -&gt; 200kb
  32. R[esources].java Aids resource lookup
  33. Type lost
  34. Type lost
  35. Type lost
  36. Type lost
  37. Needs cast Scala accepts casting very reluctantly asInstanceOf is a method (final) Accept a generic argument
  38. Needs cast Scala accepts casting very reluctantly asInstanceOf is a method (final) Accept a generic argument
  39. Needs cast Scala accepts casting very reluctantly asInstanceOf is a method (final) Accept a generic argument
  40. Needs cast Scala accepts casting very reluctantly asInstanceOf is a method (final) Accept a generic argument
  41. Needs cast Scala accepts casting very reluctantly asInstanceOf is a method (final) Accept a generic argument
  42. Generated by SBT android plugin with TypedActivity
  43. Generated by SBT android plugin with TypedActivity
  44. Generated by SBT android plugin with TypedActivity
  45. Generated by SBT android plugin with TypedActivity
  46. Generated by SBT android plugin with TypedActivity
  47. In java In scala Can we do better?
  48. Button extends View Can not add functions
  49. Button extends View Can not add functions
  50. Button extends View Can not add functions
  51. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  52. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  53. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  54. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  55. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  56. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  57. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  58. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  59. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  60. Add methods to class Implicit conversion Must be imported onClick View =&gt; Unit
  61. I.e calculation or network 5 seconds &amp; a touch Developer guide Design for responsiveness
  62. Android provided asynchronous task Drawback: Single thread; not thread pool
  63. Android provided asynchronous task Drawback: Single thread; not thread pool
  64. Android provided asynchronous task Drawback: Single thread; not thread pool
  65. Android provided asynchronous task Drawback: Single thread; not thread pool
  66. Android provided asynchronous task Drawback: Single thread; not thread pool
  67. We need to update GUI
  68. Activity.runOnUiThread(Runnable)
  69. Activity.runOnUiThread(Runnable)
  70. Activity.runOnUiThread(Runnable)
  71. Activity.runOnUiThread(Runnable)
  72. Combined version Drop noise code Same trick as with listeners
  73. Combined version Drop noise code Same trick as with listeners
  74. Combined version Drop noise code Same trick as with listeners
  75. Combined version Drop noise code Same trick as with listeners
  76. Combined version Drop noise code Same trick as with listeners
  77. Combined version Drop noise code Same trick as with listeners
  78. Combined version Drop noise code Same trick as with listeners
  79. Combined version Drop noise code Same trick as with listeners
  80. Drop more noise code Drop AsyncTask object Drop execute
  81. Pass data needed with success and failure path
  82. Pass data needed with success and failure path
  83. Pass data needed with success and failure path
  84. Pass data needed with success and failure path
  85. Pass data needed with success and failure path
  86. Pass data needed with success and failure path
  87. Pass data needed with success and failure path
  88. Pass data needed with success and failure path
  89. Pass data needed with success and failure path
  90. Pass data needed with success and failure path
  91. Pass data needed with success and failure path
  92. Pass data needed with success and failure path
  93. Pass data needed with success and failure path
  94. Pass data needed with success and failure path