serial Bundle from URL parameters - Android Android OS

Android examples for Android OS:Bundle

Description

serial Bundle from URL parameters

Demo Code


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

public class Main {

    public static Bundle serialBundle(String params) {
        Bundle bundle = null;/*from  w  ww  .ja va2s.co  m*/
        if (params != null && params.length() > 0) {
            bundle = new Bundle();
            String[] strs = params.split("&");
            String[] pairs = null;
            for (String str : strs) {
                pairs = str.split("=");
                if (pairs.length >= 2) {
                    bundle.putString(pairs[0], pairs[1]);
                }
            }
        }

        return bundle;
    }
}

Related Tutorials