tag:blogger.com,1999:blog-1172862380341707888.post2082684603914340970..comments2017-02-21T22:14:54.239-08:00Comments on Scala Android blog: Using scala.concurrent.Future on AndroidSung-Ho Leehttps://plus.google.com/101502680169820776781noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-1172862380341707888.post-61105491922364494902014-08-30T01:08:45.686-07:002014-08-30T01:08:45.686-07:00I didn&#39;t know about AsyncTask.THREAD_POOL_EXEC...I didn&#39;t know about AsyncTask.THREAD_POOL_EXECUTOR. I updated the post. Thanks!Sung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-31770255416598824072014-08-07T07:10:09.604-07:002014-08-07T07:10:09.604-07:00You should consider using a system Executor instea...You should consider using a system Executor instead of creating your own. This way you stay compatible with Android&#39;s idea of concurrency.<br /><br />implicit lazy val ThreadPoolExecutionContext = ExecutionContext.fromExecutor( AsyncTask.THREAD_POOL_EXECUTOR )<br /><br />Also I&#39;ve just written a Future implementation that comes with predefined (but still overridable) ExecutionContexts to run the body code on the above ThreadPool but run the callbacks on the UI thread.<br /><br />https://github.com/Taig/Android-Toolbelt/blob/master/src/main/scala/com/taig/android/concurrent/Future.scalaNiklas Kleinhttps://www.blogger.com/profile/02803121135152325767noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-55937818425839180992014-06-25T06:17:09.758-07:002014-06-25T06:17:09.758-07:00Now I updated the document. Thanks for suggestion!...Now I updated the document. Thanks for suggestion!Sung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-54262238792500138542014-05-22T03:29:53.297-07:002014-05-22T03:29:53.297-07:00Why don&#39;t you place this useful info in the ma...Why don&#39;t you place this useful info in the main doc: https://github.com/pocorall/scaloid/ ?David Pérezhttps://www.blogger.com/profile/10433791868099639795noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-28517381232369142032014-03-05T06:47:58.837-08:002014-03-05T06:47:58.837-08:00And if you want to do some task that is longer tha...And if you want to do some task that is longer than activity lifecycle, consider using Service :-DSung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-29798382238651236472014-03-05T06:46:07.713-08:002014-03-05T06:46:07.713-08:00This might be help:
val active = false
onDestroy(...This might be help:<br /><br />val active = false<br />onDestroy(active = false)<br />onCreate(active = true)<br /><br />future {<br /> doSomeTask()<br /> if(active) toast(&quot;finished&quot;)<br />}Sung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-47068616577595241362014-02-26T11:01:07.597-08:002014-02-26T11:01:07.597-08:00Hi, I&#39;m also new to scaloid and trying to use ...Hi, I&#39;m also new to scaloid and trying to use future to replace the original AsyncTask.<br /><br />I&#39;m wondering how to scala future deal with the issue that Activity got recreated before an async task finish and call the runOnUiThread()? In this case, all the objects when runOnUiThread() are pointers that out of date.<br /><br />Traditional way of using AsyncTask seems to be adding a task.cancel() in onStop(), does scala future or scaloid support this?<br /><br />Thanks!Mikehttps://www.blogger.com/profile/12367462706431163424noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-82876673724687085362013-11-20T22:32:03.221-08:002013-11-20T22:32:03.221-08:00Thanks, Suong-Ho. Will try.Thanks, Suong-Ho. Will try.Han Binghttps://www.blogger.com/profile/00178035058791705666noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-9919091845009576852013-11-20T01:56:24.212-08:002013-11-20T01:56:24.212-08:00The performance impact is not noticable. This app ...The performance impact is not noticable. This app is made with Scaloid, try this yourself:<br /><br />https://play.google.com/store/apps/details?id=com.soundcorset.client.androidSung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-1631184050142788912013-11-19T22:15:32.210-08:002013-11-19T22:15:32.210-08:00Sung-Ho: Your hint is very helpful. One small ques...Sung-Ho: Your hint is very helpful. One small question: will this customized context affect performance on mobile device? Are there good values for those parameters?Han Binghttps://www.blogger.com/profile/00178035058791705666noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-74490095976968932132013-11-19T05:46:34.475-08:002013-11-19T05:46:34.475-08:00For sure... thanks... so sorry :-(For sure... thanks... so sorry :-(haifischhttps://www.blogger.com/profile/16116338544102161135noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-67638540349131809412013-11-19T05:40:27.357-08:002013-11-19T05:40:27.357-08:00runOnUiThread would be helpful:
https://github.co...runOnUiThread would be helpful:<br /><br />https://github.com/pocorall/scaloid#asynchronous-task-processingSung-Ho Leehttps://www.blogger.com/profile/09029068454602662989noreply@blogger.comtag:blogger.com,1999:blog-1172862380341707888.post-91218632042821927682013-11-19T05:32:49.915-08:002013-11-19T05:32:49.915-08:00Many thanks. Looks very easy. One questions remain...Many thanks. Looks very easy. One questions remain (at least to me as a Scala newbie). What if I want the continuation to run on the UI thread in order to manipulate some UI state on the callback? How can I achieve this?haifischhttps://www.blogger.com/profile/16116338544102161135noreply@blogger.com