2017-05-06 7 views
0

ich meine Bewerbung ich URl analysieren sollte, und ich sollte id Zahl von IdWie kann ich analysieren URL in Android

http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA

bekommen Wie kann ich diese URL analysieren und erhalten ID und Prof?

Antwort

1

Verwenden 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"); 
0
Uri uri = Uri.parse("http://example.com/cat/detail/proc?id=147&_prof=W6IYDQZ2F2YOVBC78RUA"); 
String id = uri.getQueryParameter("id"); 
0

Versuchen Sie, diese

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()); 
    } 
Verwandte Themen