private static String buildMessage(String prefix, String format, Object... args) {
   String msg;
   try {
     msg = (args == null || args.length == 0) ? format : String.format(Locale.US, format, args);
   } catch (IllegalFormatException ife) {
     e("Log", ife, "IllegalFormatException: formatString='%s' numArgs=%d", format, args.length);
     msg = format + " (An error occurred while formatting the message.)";
   }
   return String.format(Locale.US, "%s: %s", prefix, msg);
 }