how to url encode in android?

前端 未结 8 735
盖世英雄少女心
盖世英雄少女心 2020-12-05 10:59

I am using grid view for displaying image using xml parsing,i got some exception like

java.lang.IllegalArgumentException: Illegal character in path a

8条回答
  •  抹茶落季
    2020-12-05 11:29

    You don't encode the entire URL, only parts of it that come from "unreliable sources" like.

    String query = URLEncoder.encode("Hare Krishna ", "utf-8");
    String url = "http://stackoverflow.com/search?q=" + query;
    

提交回复
热议问题