URLEncodedUtils deprecated in Android

后端 未结 1 1901
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 00:23

URLEncodedUtils is deprecated in Android API 22+. What could I use instead in this code?

I need to change URLEncode.Utils.Format() line.

<
相关标签:
1条回答
  • 2021-01-29 00:59

    You can use java inbuilt method java.net.URLEncoder to construct url with param data. URLEncoder.encode(yParam, "UTF-8")

    Change your method and check it.

    `public String construct() {
        return (iftrue? HOSTING_NAME : _NAME) + yDomain
                + (param.size() > 0 ? "?" + URLEncoder.encode(yParam, "UTF-8"): "");}`
    
    0 讨论(0)
提交回复
热议问题