Looper.prepare()

Showing posts with label Looper.prepare(). Show all posts
Showing posts with label Looper.prepare(). Show all posts

Sunday, September 28, 2014

Handling Looper.prepare() in android.....


This article shows how to handle Looper.prepare() in android.

Show Toast inside Thread by using UiThread.


new Thread() {
        @Override
        public void run() {
               try {
                     // code runs in a thread
                     runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                dialog.dismiss();
                            }
                     });
               } catch (final Exception ex) {
                   Log.i("---","Exception in thread");
               }
        }
 }.start();
This will avoid Looper.prepare() in android.