Read Bundle to String - Android Android OS

Android examples for Android OS:Bundle Get

Description

Read Bundle to String

Demo Code


//package com.book2s;

import android.os.Bundle;

public class Main {
    public static String toString(Bundle b) {
        if (b == null) {
            return "";
        }// w  w w .j  a v  a2 s. com

        StringBuffer buff = new StringBuffer();
        for (String key : b.keySet()) {
            final Object value = b.get(key);
            final String s = String.format("%s %s (%s)\n", key,
                    value.toString(), value.getClass().getName());
            buff.append(s);
        }
        return buff.toString();
    }
}

Related Tutorials