0

I know handler attached to a main thread runs on main thread.

final Handler handler = new Handler(Looper.getMainLooper());

handler.postDelayed(new Runnable() {
            @Override
            public void run() {


        }, DELAY_MS);

In the above does the run method actually gets executed on a different back-round thread.

mzz
  • 101
  • 1
  • 8

1 Answers1

0

No this will just get executed on the MainThread.

Why? Because the Runnable you are creating is queued inside the Loopers MessageQueue (can contain Runnables or other things ) which will be processed sequentially. If you want to get a deeper understanding there was already a great question about the Looper asked

Rene Ferrari
  • 4,096
  • 3
  • 22
  • 28