private static String reportListContents(Collection<ProcessErrorStateInfo> errList){
  if (errList == null)   return null;
  StringBuilder builder=new StringBuilder();
  Iterator<ProcessErrorStateInfo> iter=errList.iterator();
  while (iter.hasNext()) {
    ProcessErrorStateInfo entry=iter.next();
    String condition;
switch (entry.condition) {
case ActivityManager.ProcessErrorStateInfo.CRASHED:
      condition="a CRASH";
    break;
case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
  condition="an ANR";
break;
default :
condition="an unknown error";
break;
}
builder.append(String.format("Process %s encountered %s (%s)",entry.processName,condition,entry.shortMsg));
if (entry.condition == ActivityManager.ProcessErrorStateInfo.CRASHED) {
builder.append(String.format(" with stack trace:\n%s\n",entry.stackTrace));
}
builder.append("\n");
}
return builder.toString();
}

private static String reportListContents ( Collection < ProcessErrorStateInfo > errList ) { if ( errList == null ) return null ; StringBuilder builder = new StringBuilder ( ) ; Iterator < ProcessErrorStateInfo > iter = errList . iterator ( ) ; while ( iter . hasNext ( ) ) { ProcessErrorStateInfo entry = iter . next ( ) ; String condition ; switch ( entry . condition ) { case ActivityManager . ProcessErrorStateInfo . CRASHED : condition = "a CRASH" ; break ; case ActivityManager . ProcessErrorStateInfo . NOT_RESPONDING : condition = "an ANR" ; break ; default : condition = "an unknown error" ; break ; } builder . append ( String . format ( "Process %s encountered %s (%s)" , entry . processName , condition , entry . shortMsg ) ) ; if ( entry . condition == ActivityManager . ProcessErrorStateInfo . CRASHED ) { builder . append ( String . format ( " with stack trace:\n%s\n" , entry . stackTrace ) ) ; } builder . append ( "\n" ) ; } return builder . toString ( ) ; }
this helper function will dump the actual error reports .
