On Tue, Jun 10, 2014 at 2:08 PM, Shadowburst <[email protected]> wrote:
> So far I've seen that Scala offers safe, composable, scalable approaches to
> concurrency, whether it's by using Future or going all-out with Akka. I've
> also seen that lots of people have trouble getting Akka working at all on
> Android, and I wonder whether it's worth the risk.
>
> Android also has its own concurrency mechanisms: on top of what Java gives
> you, it has AsyncTask and Handler, and it has the requirement to update your
> GUI on the main thread.
>
> What I'm wondering is, if I start using Scala concurrency, how can I get my
> background tasks to communicate with the main thread? It seems like there
> might be some alternatives (as follows), but I'd like to know what people
> are actually using for real development, rather than beating a path through
> unknown jungles.
>
> Is there some way to communicate with a Handler on the main thread as if it
> were an Akka Actor?
> Or is it possible to get callbacks from Future that are guaranteed to run on
> the main thread?
> Or perhaps the best way is just to use AsyncTask and Loader the same way I
> did in Java.
>
> My needs are pretty simple: I don't want anything complicated like
> task-based parallelism, just an easy way to have ongoing background work
> that pokes the GUI with new data now and then. So far, I haven't found a way
> of getting things back to the main thread without stepping outside Scala's
> concurrency ops.

Scaloid has: 
https://github.com/pocorall/scaloid/wiki/Basics#asynchronous-task-processing

We're using https://github.com/koush/ion for making ajax calls, which
does ajax requests
in a separate thread and calls handlers in the UI thread.

A major complication that Ion addresses (mostly) is that the UI
context you would use might
have gone away.

Jim

-- 
Jim Fulton
http://www.linkedin.com/in/jimfulton

-- 
You received this message because you are subscribed to the Google Groups 
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to