Makistos
6/8/2016 - 8:07 AM

Printing stack trace in Android. #java

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);
  }
}