Skip to content

Instantly share code, notes, and snippets.

@Makistos
Last active March 22, 2017 08:00
Show Gist options
  • Save Makistos/2feb74cc67c9ae46fdca10ad71fc64c0 to your computer and use it in GitHub Desktop.
Save Makistos/2feb74cc67c9ae46fdca10ad71fc64c0 to your computer and use it in GitHub Desktop.
Printing stack trace in Android. #java
// Get stacks for every thread
import java.util.*;
Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
for (Thread key : map.keySet()) {
for (StackTraceElement ste : map.get(key)) {
Log.e(TAG, "TRACE: (" + key.toString() + ":" + key.getId() + ") " + ste);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment