Skip to content

Instantly share code, notes, and snippets.

@RightHandedMonkey
Created September 13, 2017 15:22
Android get thread names
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