Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.os.Bundle;

public class Main {
    /**
     * Convert bundle to readable string
     *
     * @param bundle The bundle to convert
     * @return String representation of bundle
     */
    public static String toString(Bundle bundle) {
        if (bundle == null) {
            return null;
        }
        StringBuilder stringBuilder = new StringBuilder();
        for (String key : bundle.keySet()) {
            Object value = bundle.get(key);
            stringBuilder.append(
                    String.format("%s %s (%s)\n", key, value, value == null ? "null" : value.getClass().getName()));
        }
        return stringBuilder.substring(0, stringBuilder.length() - 1);
    }
}