Is it OK to use `scala.actors.Actor` object in an Android application?

左心房为你撑大大i 提交于 2019-12-12 01:08:41

问题


I know that it works, just checked. I'm wondering about the system not being able to free memory or the application "hanging" in the background or such things.

import scala.actors.Actor
import android.util.Log

object Player extends Actor {

  start

  def act {
    loop {
      react {
        case x => Log.v("actor", "received: " + x)
      }
    }
  }

}

Actors are so much more graspable than concurrency using regular threads. I guess scala.actors is build upon JVM threads, so maybe it's as legal as using normal threads in your app?


回答1:


You shouldn't be using native scala actors, as they're deprecated. But you can run AKKA on Android. You can see this thread for more information and sample code: https://groups.google.com/forum/?fromgroups=#!topic/akka-user/1W41nAONv90



来源:https://stackoverflow.com/questions/16137585/is-it-ok-to-use-scala-actors-actor-object-in-an-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!