Java tutorial
//package com.java2s; import android.content.Intent; import android.net.Uri; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; public class Main { public static final HashMap<String, String> getAllRawQueryParameters(Intent intent) { HashMap<String, String> queries = new HashMap<String, String>(); if (intent != null) { Uri uri = intent.getData(); if (null != uri) { final String query = uri.getEncodedQuery(); if (query != null) { final int length = query.length(); int start = 0; do { int nextAmpersand = query.indexOf('&', start); int end = nextAmpersand != -1 ? nextAmpersand : length; int separator = query.indexOf('=', start); if (separator > end || separator == -1) { separator = end; } String encodedKey = query.substring(start, separator); String encodedValue = query.substring(separator + 1, end); String key = Uri.decode(encodedKey); if (!queries.containsKey(key)) { queries.put(key, encodedValue); } // Move start to end of name. if (nextAmpersand != -1) { start = nextAmpersand + 1; } else { break; } } while (true); } } } return queries; } private static String decode(final String content, final String encoding) { try { return URLDecoder.decode(content, encoding != null ? encoding : "UTF-8"); } catch (UnsupportedEncodingException problem) { throw new IllegalArgumentException(problem); } } }