如何在Android中将字符串转换为Unicode [英] How to convert string into unicode in android

查看:565
本文介绍了如何在Android中将字符串转换为Unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将json中的某些unicodes解析为我的android应用程序,该api给出unicodes这样的图标,如\ue600,当我将此unicode直接添加到textview中时,例如textview.setText("\ue600");时,在textview上提供正确的图标.但是当我从json api&解析此unicode时,那么我setText那个unicode它只是在textview上显示\ue600. 我如何将这些字符串解析或转换为unicodes以获得textview中的图标.

I am parsing some unicodes from json to my android app, the api gives unicodes of icons like \ue600, When I add this unicode directly into the textview like textview.setText("\ue600"); it gives right icon on the textview. but when i parse this unicode from json api & then I setText that unicode it just displays \ue600 on textview. How I parse or convert these strings into unicodes to get the icons in textview.

谢谢

推荐答案

将您的unicode转换为这种格式&然后像这样在textview textview.setText(Html.fromHtml(your_unicode_here));中使用 应该可以.

Convert your unicode into this format  & then use like this in your textview textview.setText(Html.fromHtml(your_unicode_here)); It should work.

这篇关于如何在Android中将字符串转换为Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆