Created
September 13, 2017 15:22
-
-
Save RightHandedMonkey/c9f8a8f5bcbe3e5fecd628e603de796d to your computer and use it in GitHub Desktop.
Android get thread names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestUtils { | |
public static String getThreadDetails() { | |
if (Looper.myLooper() == Looper.getMainLooper()) | |
return "Currently running on the main thread. "+getThreadName(); | |
else | |
return "Not running on the main thread. "+getThreadName(); | |
} | |
public static String getThreadName() { | |
return Thread.currentThread().getName()+" - "+Thread.currentThread().getId(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment