EditText fromHtml can not convert & to &

Multi tool use
Multi tool use


EditText fromHtml can not convert & to &



I have a editText which is showing Html contents but when I try to show &amp as & it does not work. It's still showing &amp.



How I am doing it -


description.setText(Html.fromHtml("Locator & Navigator ( Location )"));





& are sure you aren't missing anything
– Killer
Jul 3 at 7:13





1 Answer
1



Try this


String value = "some value & some other value";
description.setText(Html.fromHtml(value.replaceAll("&","amp;")));



OUTPUT



enter image description here





I am sorry it is like this actually - Locator & Navigator ( Location ) It's coming from server actually
– Anirban
Jul 3 at 6:00






The server returns amp; two times? then I think the server's response is incorrect.
– Hong Duan
Jul 3 at 6:41


amp;





@HongDuan agree with u
– Nilesh Rathod
Jul 3 at 6:42





@Anirban You can always replace & with &
– Kling Klang
Jul 3 at 8:49



&


&





@Anirban check updated answer thanks to KlingKlang
– Nilesh Rathod
Jul 3 at 9:01






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Jo4jgASksxXP6Z9hx,feTAce0o0nKV5B299RaXu,tcuyyabIia8VWwggwUlEtEUI4V
1qlGUvCtXo ZV9,2T 8pXC x,hYhxmWPn8ss,PVcnMqDvhicFxvvw rFOR,Y4ZFHR

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications