本文介绍了是否确定使用`scala.actors.Actor`对象在Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道它的工作原理,只是检查。我想了解一下不能够释​​放内存或应用程序挂在后台或这样的事情该系统。

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)
      }
    }
  }

}

演员有这么多的抓握的并发性比使用普通线程。我猜 scala.actors 是建立在JVM线程,因此也许这是法律在你的应用程序中使用线程正常?

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?

推荐答案

您不应该使用本地斯卡拉行为者,因为他们是去precated。但是你可以在Android上运行AKKA。你可以看到这个主题的更多信息和样品code:<一href=\"https://groups.google.com/forum/?fromgroups=#!topic/akka-user/1W41nAONv90\">https://groups.google.com/forum/?fromgroups=#!topic/akka-user/1W41nAONv90

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

这篇关于是否确定使用`scala.actors.Actor`对象在Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 03:48