deserialize Bundle to String - Android Android OS

Android examples for Android OS:Bundle

Description

deserialize Bundle to String

Demo Code


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

public class Main {

    public static String deserialBundle(Bundle bundle) {
        if (bundle == null)
            return null;
        StringBuilder params = new StringBuilder();
        for (String key : bundle.keySet()) {
            params.append(key + "=" + bundle.get(key) + "&");
        }/*from ww  w.  j a va 2s.  c o m*/

        return params.length() > 0 ? params.substring(0,
                params.length() - 1) : null;
    }
}

Related Tutorials