get URL Query Map and save to Map<String, String> - Android Network

Android examples for Network:URL

Description

get URL Query Map and save to Map<String, String>

Demo Code


//package com.java2s;

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static Map<String, String> getQueryMap(String query) {
        String[] params = query.split("&");
        Map<String, String> map = new HashMap<String, String>();
        for (String param : params) {
            String[] splitted = param.split("=");
            map.put(splitted[0], splitted[1]);
        }/* ww w .j av a2  s .  co  m*/
        return map;
    }
}

Related Tutorials