Skip to content

Instantly share code, notes, and snippets.

@RightHandedMonkey
Created September 13, 2017 15:22
Show Gist options
  • Save RightHandedMonkey/c9f8a8f5bcbe3e5fecd628e603de796d to your computer and use it in GitHub Desktop.
Save RightHandedMonkey/c9f8a8f5bcbe3e5fecd628e603de796d to your computer and use it in GitHub Desktop.
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