Android URLEncoder warning

When developing Android and going up in API level you’ll run into this warning when using URLEncoder.encode(String s).

You should use the URLEncoder.encode(String s, String CharsetName) instead. The warning: “The method encode(String) from the type URLEncoder is deprecated”

Set the CharsetName to “UTF-8”

Info: “public static String encode (String s)

Since: API Level 1

This method is deprecated.
use encode(String, String) instead.

Equivalent to encode(s, “UTF-8″).”

Posted in Android, ErrorFix Tagged with: , ,