java android new String
•
Java
I have to convert a byte array to a string So I use this function:
public static String byteToString(byte[] bytes) { String str = new String(bytes,Charset.forName("UTF8")); return str; }
The problem is that it requires API 9:
API level 9 is required for calling (the current minimum value is 8): new Java lang.String
But I also want to provide my application to API 8 users Is there any possibility or alternative?
Solution
You can use new string (bytes, "utf8") (constructor string (byte [], string)) It is always available (API level 1)
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码