Created
January 7, 2015 15:42
-
-
Save TechIsFun/cc724e33bceb123bd27a to your computer and use it in GitHub Desktop.
Dump content of bundle to a String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String bundle2String(Bundle bundle) { | |
| StringBuilder sb = new StringBuilder(); | |
| List<String> keys = new ArrayList<String>(bundle.keySet()); | |
| Collections.sort(keys); | |
| for (String key : keys) { | |
| Object value = bundle.get(key); | |
| if (value == null) { | |
| sb.append(String.format("%s: null", key)); | |
| } else { | |
| sb.append(String.format("%s: %s (%s)", key, value.toString(), value.getClass().getName())); | |
| } | |
| sb.append("\n"); | |
| } | |
| return sb.toString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment