Java tutorial
//package com.java2s; import android.os.Bundle; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; public class Main { public static Bundle parseUrl(String url) { Bundle ret; url = url.replace("bdconnect", "http"); try { URL urlParam = new URL(url); ret = decodeUrl(urlParam.getQuery()); ret.putAll(decodeUrl(urlParam.getRef())); return ret; } catch (MalformedURLException e) { return new Bundle(); } } public static Bundle decodeUrl(String query) { Bundle ret = new Bundle(); if (query != null) { String[] pairs = query.split("&"); for (String pair : pairs) { String[] keyAndValues = pair.split("="); if (keyAndValues != null && keyAndValues.length == 2) { String key = keyAndValues[0]; String value = keyAndValues[1]; if (!isEmpty(key) && !isEmpty(value)) { ret.putString(URLDecoder.decode(key), URLDecoder.decode(value)); } } } } return ret; } public static boolean isEmpty(String query) { boolean ret = false; if (query == null || query.trim().equals("")) { ret = true; } return ret; } }