Multithreading in a UI Environment

Embed Size (px)

Citation preview

  • 7/31/2019 Multithreading in a UI Environment

    1/12

    Everyday DeveloperEveryday Developerhttp://www.aviyehuda.comhttp://www.aviyehuda.com

    HOMEHOME

    OPEN SOURCEOPEN SOURCE

    ANDROIDANDROID

    JAVAJAVA

    OTHERSOTHERS

    CONTACT MECONTACT ME

    ABOUT MEABOUT ME

    Previous Next

    Android Multithreading in a UI environmentPosted on 20/12/2010

    Why do we need multithreading in Android applications?

    Lets say you want to do a very long operation when the user pushes a button.

    If you are not using another thread, it will look something like this:

    What will happen?

    The UI freezes. This is a really bad UI experience. The program may even crash.

    The problem in using threads in a UI environment

    So what will happen if we use a Thread for a long running operation.

    Lets try a simple example:

    1 ((Button)findViewById(R.id.Button01)).setOnClickListener(2 new OnClickListener() {3 4 @Override5 publicvoid onClick(View v) {6 int result = doLongOperation();7 updateUI(result);8 }

    9 });

    01 ((Button)findViewById(R.id.Button01)).setOnClickListener(02 new OnClickListener() {03 04 @Override05 publicvoid onClick(View v) {06 07 (new Thread(new Runnable() {08 09 @Override10 publicvoid run() {11 int result = doLongOperation();12 updateUI(result);

    converted by Web2PDFConvert.com

    http://www.aviyehuda.com/http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2011/01/27/android-creating-links-using-linkfy/http://www.aviyehuda.com/blog/2010/11/28/andoid-opening-a-new-screen/http://www.aviyehuda.com/about/http://www.aviyehuda.com/contact-me/http://www.aviyehuda.com/others/http://www.aviyehuda.com/java/http://www.aviyehuda.com/android/http://www.aviyehuda.com/open-source/http://www.aviyehuda.com/http://www.aviyehuda.com/
  • 7/31/2019 Multithreading in a UI Environment

    2/12

    The result in this case is that the application crashes.

    12-07 16:24:29.089: ERROR/AndroidRuntime(315): FATAL EXCEPTION: Thread-8

    12-07 16:24:29.089: ERROR/AndroidRuntime(315): android.view.ViewRoot$CalledFromWrongThreadException: Only the

    original thread that created a view hierarchy can touch its views.

    12-07 1 6:24:29.089: ERROR/AndroidRuntime(315): at ...

    Clearly the Android OS wont let threads other than the main thread change UI elements.

    But why?

    Android UI toolkit, like many other UI environments, is not thread-safe.

    The solution

    A queue of messages. Each message is a job to be handled.

    Threads can add messages.

    Only a single thread pulls messages one by one from the queue.

    The same solution was implemented in swing (Event dispatching threadand SwingUtilities.invokeLater() )

    Handler

    TheHandleris the middleman between a new thread and the message queue.

    Option 1 Run the new thread and use the handler to send messages for ui changes

    * keep in mind that updating the UI should still be a short operation, since the UI freezes during the updating process.

    Other possibilities:

    handler.obtainMessage with parameters

    handler.sendMessageAtFrontOfQueue()

    handler.sendMessageAtTime()

    handler.sendMessageDelayed()

    handler.sendEmptyMessage()

    Option 2 run the new thread and use the handler to post a runnable which updates the GUI.

    13 }14 })).start();15 16 }

    01 final Handler myHandler = new Handler(){

    02 @Override03 publicvoid handleMessage(Message msg) {04 updateUI((String)msg.obj);05 }06 07 };08 09 (new Thread(new Runnable() {10 11 @Override12 publicvoid run() {13 Message msg = myHandler.obtainMessage();14 15 msg.obj = doLongOperation();16 17 myHandler.sendMessage(msg);18 }19 })).start();

    01 final Handler myHandler = new Handler();02 03 (new Thread(new Runnable() {04 05 @Override06 publicvoid run() {07 final String res = doLongOperation();08 myHandler.post(new Runnable() {

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://developer.android.com/reference/android/os/Handler.htmlhttp://download.oracle.com/javase/1.4.2/docs/api/javax/swing/SwingUtilities.html#invokeLater%28java.lang.Runnable%29http://en.wikipedia.org/wiki/Event_dispatching_thread
  • 7/31/2019 Multithreading in a UI Environment

    3/12

    LooperIf we want to dive a bit deeper into the android mechanism we have to understand what is a Looper.

    We have talked about the message queue that the main thread pulls messages and runnables from it and executes

    them.

    We also said that each handler you create has a reference to this queue.

    What we havent said yet is that the main thread has a reference to an object named Looper.

    The Looper gives the Thread the access to the message queue.

    Only the main thread has executes to the Looper by default.

    Lets say you would like to create a new thread and you also want to take advantage of the message queue

    functionality in that thread.

    Here we created a new thread which uses the handler to put a message in the messages queue.

    This will be the result:

    12-10 20:41:51.807: ERROR/AndroidRuntime(254): Uncaught handler: thread T hread-8 e xiting due to uncaught exce ption

    12-10 20:41:51.817: ERROR/AndroidRuntime(254): java.lang.RuntimeException: Can't create handler inside thread that has

    not called Looper.prepare()12-10 2 0:41:51.817: ERROR/AndroidRuntime(254): at android.os.Handler.(Handler.java:121)

    12-10 2 0:41:51.817: ERROR/AndroidRuntime(254): at ...

    09 10 @Override11 publicvoid run() {12 updateUI(res);13 }14 });15 }16 })).start();17 18 }

    01 (new Thread(new Runnable() {

    02 03 @Override04 publicvoid run() {05 06 innerHandler = new Handler();07 08 Message message = innerHandler.obtainMessage();09 innerHandler.dispatchMessage(message);10 }11 })).start();

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://developer.android.com/reference/android/os/Looper.html
  • 7/31/2019 Multithreading in a UI Environment

    4/12

    The new created thread does not have a Looper with a queue attached to it. Only the UI thread has a Looper.

    We can however create a Looper for the new thread.

    In order to do that we need to use 2 functions: Looper.prepare() and Looper.loop().

    If you use this option, dont forget to use also the quit() function so the Looper will not loop for ever.

    AsyncTask

    I have explained to you that a Handler is the new threads way to communicate with the UI thread.

    If while reading this you were thinking to yourself, isnt there an easier way to do all of that well, you know what?!

    There is.

    Android team has created a class calledAsyncTask which is in short a thread that can handle UI.

    Just like in java you extend the class Thread and a SwingWorkerin Swing, in Android you extend the class AsyncTask.

    There is no interface here like Runnable to implement Im afraid.

    01 (new Thread(new Runnable() {02 03 @Override04 publicvoid run() {05 06 Looper.prepare();07 innerHandler = new Handler();08 09 Message message = innerHandler.obtainMessage();10 innerHandler.dispatchMessage(message);11 Looper.loop();12 }13 })).start();

    1 @Override2 protectedvoid onDestroy() {3 innerHandler.getLooper().quit();4 super.onDestroy();5 }

    01 class MyAsyncTask extends AsyncTask {02 03 @Override04 protected Long doInBackground(Integer... params) {05 06 long start = System.currentTimeMillis();07 for (Integer integer : params) {08 publishProgress("start processing "+integer);09 doLongOperation();10 publishProgress("done processing "+integer);11 }12 13 return start - System.currentTimeMillis();14 }15 16 17 18 @Override19 protectedvoid onProgressUpdate(String... values) {20 updateUI(values[0]);21 }22 23 @Override24 protectedvoid onPostExecute(Long time) {25 updateUI("Done with all the operations, it took:" +26 time + " millisecondes");27 }28 29 @Override30 protectedvoid onPreExecute() {31 updateUI("Starting process");32 }33 34 35 publicvoid doLongOperation() {36

    37 try {38 Thread.sleep(1000);39 } catch (InterruptedException e) {40 e.printStackTrace();41 }42 43 }44 45 }

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://download.oracle.com/javase/6/docs/api/javax/swing/SwingWorker.htmlhttp://developer.android.com/reference/android/os/AsyncTask.htmlhttp://developer.android.com/reference/android/os/Looper.html#loop()http://developer.android.com/reference/android/os/Looper.html#prepare()
  • 7/31/2019 Multithreading in a UI Environment

    5/12

    This is how you start this thread:

    AsyncTask defines 3 generic types:

    AsyncTaskYou dont have to use all of them simply use Void for any of them.

    Notice that AsyncTask has 4 operations, which are executed by order.

    1. onPreExecute() is invoked before the execution.

    2. onPostExecute() - is invoked after the execution.

    3. doInBackground() - the main operation. Write your heavy operation here.

    4. onProgressUpdate() Indication to the user on progress. It is invoked every time publishProgress() is called.

    * Notice: doInBackground() is invoked on a background thread where onPreExecute(), onPostExecute() and

    onProgressUpdate() are invoked on the UI thread since their purpose is to update the UI.

    Android developer website also mentions these 4 rules regarding the AsyncTask:

    The task instance must be created on the UI thread.

    execute(Params) must be invoked on the UI thread.

    Do not call onPreExecute(), onPostExecute(Result), doInBackground(Params), onProgressUpdate(Progress)

    manually.

    The task can be executed only once (an exception will be thrown if a second execution is attempted.)

    Timer + TimerTask

    Another option is to use aTimer.

    Timer is a comfortable way to dispatch a thread in the future, be it once or more.

    Instead of doing this:

    do this:

    which is a bit more elegant.

    Bare in mind, you still have to use Handler if you need to do UI operations.

    1 MyAsyncTask aTask = new MyAsyncTask();2 aTask.execute(1, 2, 3, 4, 5);

    01 Runnable threadTask = new Runnable() {02 03 @Override04 publicvoid run() {05 06 while(true){07 try {08 Thread.sleep(2000);09 } catch (InterruptedException e) {

    10 e.printStackTrace();11 }12 13 doSomething();14 }15 }16 };17 18 (new Thread(threadTask)).start();

    1 TimerTask timerTask = new TimerTask() {2 @Override3 publicvoid run() {4 doSomething();5 }6 };7 8 Timer timer = new Timer();9 timer.schedule(timerTask, 2000,2000);

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://developer.android.com/reference/java/util/Timer.htmlhttp://developer.android.com/reference/android/os/AsyncTask.html#publishProgress%28Progress...%29
  • 7/31/2019 Multithreading in a UI Environment

    6/12

    23 THOUGHTS ON ANDROID MULTITHREADING IN A UI ENVIRONMENT

    Pingback:Android Multithreading in a UI environment : Mike's burogu

    Download sources:

    Download demo project 1

    Download demo project 2

    Share 5 Tweet 0 Like 0ShareShare

    This entry was posted in Android and tagged Android, multithreading byAvi. Bookmark the permalink.

    P7hon21/12/2010 at 21:21 said:

    Very neatly written and explained.

    But only gripe is, code could have used better formatting / syntax highlighting JS.

    Even otherwise, an excellent article.

    Reply

    arthur on 05/01/2011 at 18:07 said:

    What a great article. I have googled for a long time looking for a good explanation of the topic,

    and this one is the best I found. Thanks!

    Reply

    Purush on 21/01/2011 at 11:53 said:

    Excellent article, Very clear.

    Reply

    Pepper on 15/03/2011 at 11:28 said:

    so great article. Thanks!

    Reply

    Hom on 13/05/2011 at 09:04 said:

    great article..got clear concept..thanks!

    Reply

    Kiran on 20/05/2011 at 08:50 said:

    Good article to clear concepts !!

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2122http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2120#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2120http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2089#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2089http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=1517#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-1517http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=1004#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-1004http://blog.bsodmike.com/2010/12/26/android-multithreading-in-a-ui-environment/http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=706#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-706http://twitter.com/P7hhttp://www.aviyehuda.com/blog/author/admin/http://www.aviyehuda.com/blog/tag/multithreading/http://www.aviyehuda.com/blog/tag/android/http://www.aviyehuda.com/blog/category/android/http://www.aviyehuda.com/downloads/AndroidMultithreading/TimerTaskTest.ziphttp://www.aviyehuda.com/downloads/AndroidMultithreading/MultithreadingTest.zip
  • 7/31/2019 Multithreading in a UI Environment

    7/12

    Reply

    karan on 21/06/2011 at 14:12 said:

    gooodddddddd

    Reply

    karan on 21/06/2011 at 14:15 said:

    in multi threadind there is only one interface Runnable() ????????????????

    Reply

    Monish on 25/07/2011 at 11:12 said:

    Thanks a lot, very useful

    Reply

    vipin on 28/07/2011 at 12:58 said:

    A very good article for understanding handler, looper, asynctask. I was reading about them for few

    days but not able to clear doubts. This article helped me a lot.

    Thanks

    Reply

    krishna K Mishra on 17/08/2011 at 21:32 said:

    Its really a great tutorial on Complete thread handling in android ..

    Thank you so much for publishing so nice tutorial.

    Reply

    Richard L. on10/11/2011 at 22:30 said:

    We have been doing programming without threads, with complexe systems and our UI wouldnt

    freeze

    I guess there are many ways to create a piece of software, that will still what it is supposed to do. You can use

    threads or not and achieve the same thing.

    Reply

    Avi

    on10/11/2011 at 22:59 said:

    Hi Richard.

    If you dont need threads thats great.

    But the question is: what do you mean by complex.

    Some of the actions require more time than others.

    If for example, your application reads pictures from the internet, than I am afraid you will have to use

    threads, this action takes a few seconds.

    Bear in mind, that the main thread can not be busy for more than 5 seconds, otherwise the OS will pop

    an alert to the user asking him whether he wishes to close down the application.

    Thanks for your comment

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2175http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2174#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2174http://android9patch.blogspot.com/http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2155#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2155http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2150#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2150http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2148#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2148http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2127#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2127http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2126#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2126http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2122#respond
  • 7/31/2019 Multithreading in a UI Environment

    8/12

    Reply

    Howard on 27/11/2011 at 16:55 said:

    The Best!

    Reply

    Eric on 22/12/2011 at 07:38 said:

    Thx, helped alot

    Reply

    Rui Pedrosa on 06/01/2012 at 12:18 said:

    A simple but very useful explanation! thanks!

    Reply

    Karol on 14/01/2012 at 01:06 said:

    Hi All the examples I see so far implement the Runnable object as inner class of the main UI

    Thread Activity. In my up I dont want to do this because my runnable does more things and it

    also extend TextView. Basically it is a timer that display minutes and second passed and does

    other things. I want it to be separate class but it does not work. Can someon post an example that uses

    runnable that modifies a UI but it is a separate class.

    Thanks

    Karol

    Reply

    neetika on 30/03/2012 at 09:38 said:

    Really simple and useful explanation about threading.i was searching like this.thanks

    Reply

    Shirish on 10/05/2012 at 10:53 said:

    Excellent article! Thanks!

    Reply

    Guest on 05/06/2012 at 23:17 said:

    > Notice that AsyncTask has 4 operations, which are executed by order.

    Shouldnt that order be 1,3,2 ????

    Reply

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2389#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2389http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2319#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2319http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2220#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2220http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2198#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2198http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2194#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2194http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2189#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2189http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2180#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2180http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2175#respond
  • 7/31/2019 Multithreading in a UI Environment

    9/12

    Pingback: Techbeast.net - Google Nexus 7 Announced - Techbeast.net

    Guest on 05/06/2012 at 23:19 said:

    > The task can be executed only once (an exception will be

    > thrown if a second execution is attempted.)

    Once per .. ?

    Per day?

    Per minute?

    After the first one finishes you can start another?

    It says only *ONCE*? So you can NEVER execute this again?

    NEVER?

    So if I need this 10 times I have to cut/paste all the code in 10 times????

    Reply

    Leave a ReplyYour email address will not be published.

    Post Comment

    About Me

    RSSRSS

    CategoriesCategories

    Android

    bluetooth

    ClientSide

    Name

    Email

    Website

    Comment

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/category/java/clientside/http://www.aviyehuda.com/blog/category/java/java-technologies/bluetooth/http://www.aviyehuda.com/blog/category/android/http://feeds.feedburner.com/aviyehuda/feedhttp://www.aviyehuda.com/about/http://www.techbeast.net/2012/06/27/google-nexus-7-announced/http://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/?replytocom=2390#respondhttp://www.aviyehuda.com/blog/2010/12/20/android-multithreading-in-a-ui-environment/comment-page-1/#comment-2390
  • 7/31/2019 Multithreading in a UI Environment

    10/12

    Clover

    General

    GreaseMonkey

    Hacks

    hibernate

    hibernate validator

    HTML5

    HtmlUnit

    Image Manipulation

    Java

    Java Technologies

    JavaScript

    Java_Mail

    JEE/Network

    Job searching

    Open Source

    Pivot

    projects

    Pure Java

    software

    Trivia

    Recent CommentsRecent Comments

    dd on Android quick tip: use

    System.arraycopy()

    Thanks a lot! This spared me the effort of

    trying for myself. Regards, Daniel

    Posted Jul 08, 2012

    Thomas on Memory Game Android

    Application

    I have successfully customized design. But

    now I have problem. I have 24 images and

    game bord 3x4, I need...

    Posted Jul 07, 2012

    Thomas on Memory Game Android

    Application

    Hi, how can I customize layout? I need

    more space between pictures. Can you

    help me. Thanks! :-)Posted Jun 27, 2012

    Jason on Connecting to Bluetooth

    devices with Java

    I can run the code, but why localDevice

    always got null? pls help!

    Posted Jun 23, 2012

    Roy on 4 JavaScript trivia

    questions that may help youunderstand the language a bit

    better

    Great refreshment

    Posted Jun 11, 2012

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2012/03/21/4-javascript-trivia-questions-that-may-help-you-understand-the-language-a-bit-better/http://www.aviyehuda.com/blog/2010/01/08/connecting-to-bluetooth-devices-with-java/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2011/06/25/android-quick-tip-use-system-arraycopy/http://www.aviyehuda.com/blog/category/java/trivia/http://www.aviyehuda.com/blog/category/software/http://www.aviyehuda.com/blog/category/java/pure-java/http://www.aviyehuda.com/blog/category/java/projects/http://www.aviyehuda.com/blog/category/java/java-technologies/pivot/http://www.aviyehuda.com/blog/category/open-source/http://www.aviyehuda.com/blog/category/job-searching/http://www.aviyehuda.com/blog/category/java/jeenetwork/http://www.aviyehuda.com/blog/category/java/java-technologies/java_mail/http://www.aviyehuda.com/blog/category/web-development/javascript/http://www.aviyehuda.com/blog/category/java/java-technologies/http://www.aviyehuda.com/blog/category/java/http://www.aviyehuda.com/blog/category/java/java-technologies/image-manipulation/http://www.aviyehuda.com/blog/category/java/java-technologies/htmlunit-java-technologies-java/http://www.aviyehuda.com/blog/category/web-development/html5/http://www.aviyehuda.com/blog/category/java/java-technologies/hibernate-validator/http://www.aviyehuda.com/blog/category/java/java-technologies/hibernate/http://www.aviyehuda.com/blog/category/hacks/http://www.aviyehuda.com/blog/category/web-development/greasemonkey/http://www.aviyehuda.com/blog/category/general/http://www.aviyehuda.com/blog/category/java/java-technologies/clover/
  • 7/31/2019 Multithreading in a UI Environment

    11/12

    Malinda on Connecting to

    Bluetooth devices with Java

    Thank you!!! this post helped me a lot~!!!

    Posted Jun 07, 2012

    Guest on Android Multithreading

    in a UI environment

    > The task can be executed only once (anexception will be > thrown if a second

    execution is attempted.) Once...

    Posted Jun 05, 2012

    Guest on Android Multithreading

    in a UI environment

    > Notice that AsyncTask has 4 operations,

    which are executed by order. Shouldn't that

    "order" be 1,3,2 ????

    Posted Jun 05, 2012

    martin on Memory Game Android

    Application

    How to judge the game has been

    successful??

    Posted Jun 02, 2012

    murat on Memory Game Android

    Application

    Can you please send me an e-mail

    attached with source codes of this game?

    The one provided by the link...

    Posted May 29, 2012

    click here on Android development

    Custom Animation

    Although I actually like this post, I think

    there was an spelling error close towards

    the finish of your third...

    Posted May 29, 2012

    Neha on Using Hibernate Validator

    to cover your validation needs

    I have a customized constraint for cross

    field validation which is to be applied to my

    bean at class level....

    Posted May 24, 2012

    Shirish on Android Multithreading

    in a UI environment

    Excellent article! Thanks!

    Posted May 10, 2012

    Tuan on Memory Game Android

    Application

    Thanks you very much, it very helpful

    Posted Ma 10, 2012

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/04/14/using-hibernate-validator-to-cover-your-validation-needs/http://www.aviyehuda.com/blog/2011/07/01/android-development-custom-animation/http://www.aol.com/515e8df529b1bf91f0edf8e007ad31932d09974ehttp://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/01/08/connecting-to-bluetooth-devices-with-java/
  • 7/31/2019 Multithreading in a UI Environment

    12/12

    laxman on Android Using SQLite

    DataBase

    thank u for the nice sqlite database code.

    please help me remaining functionalities in

    sqlitedtabse clearly Thanks, Laxman

    Posted May 05, 2012

    Faizan on Memory Game Android

    Application

    Hi, I really like your game it helps me

    understand the code within android. Just

    wanted to know if there is...

    Posted Apr 27, 2012

    melek on Memory Game Android

    Application

    bana bunu kodlarn rarlayp yollarmsn

    dogru bir ekilde proje devim iin lazm daPosted Apr 17, 2012

    neetika on Android

    Multithreading in a UI environment

    Really simple and useful explanation about

    threading.i was searching like this.thanks

    Posted Mar 30, 2012

    yan on Memory Game Android

    Applicationhello sir. sorry to interrupt you. can you

    make some explanation from the source

    code and the flowchart for this...

    Posted Mar 21, 2012

    Sujay on Memory Game Android

    Application

    I have downloaded the source code .Its

    nice game.You have given a spinner that

    shows a dropdown and on selecting...

    Posted Mar 19, 2012

    2012 2012 Everyday DeveloperEveryday Developer Admired ThemeAdmired Theme

    http://wp-ultra.com/http://www.aviyehuda.com/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/07/29/memory-game-android-application/http://www.aviyehuda.com/blog/2010/10/21/android-using-sqlite-database/http://[email protected]/