Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

I need to check if the thread running a certain piece of code is the main (UI) thread or not. How can I achieve this?

1 Answer

0 votes
by (46k points)

Try:

Looper.myLooper() == Looper.getMainLooper()

if this reflects true, when you're on the UI thread!

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...