您的位置:首页 > 其它

关于手机显示乱码问题,多谢了!

2017-01-03 05:01 239 查看
读取资源文件,模拟器运行正常,但是手机显示确是乱码?

代码如下:

    /**

     * 从资源文件中栽入字符串

     *

     */

    private String loadStringFromResource(String url) {

        try {

            InputStream is = getClass().getResourceAsStream(url);

            byte[] text = new byte[is.available()];

            is.read(text);

            is.close();

            is = null;

            return new String(text);

        } catch (Exception e) {

            return "读取资源文件失败!";

        }

    }

怎么回事?

最好能附上代码,不胜感激!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: