Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I my application I should parse URl and I should get id number from Id
URl
http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA
How can I parse this url and get id and prof ?
Use getQueryParameter()
Uri uri=Uri.parse("http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA"); String id = uri.getQueryParameter("id"); String _prof = uri.getQueryParameter("_prof");
Add a comment
Uri uri = Uri.parse("http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA"); String id = uri.getQueryParameter("id");
Try this
List<NameValuePair> parse = URLEncodedUtils.parse(URI.create("http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA"), "UTF-8"); for (NameValuePair pair : parse) { System.out.println("!!!!!!!!!! " + pair.getName() + " = " + pair.getValue()); }
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.