I am creating one sample project in android. i am using sample rss feed.
In xml description coming like this,
<![CDATA[
<p>15 Mar 2012</p>
<a href="http://newsonair.nic.in/full_news.asp?TOP2">
<p style='FONT-SIZE: 12px; LINE-HEIGHT: 150%' align='justify'>
<img style='FLOAT: left; MARGIN-RIGHT: 5px' height='100' width='100' src=http://www.newsonair.nic.in/writereaddata/news_pictures/PICNEWS1.jpg?
0.7055475></a><br/>
Parliament was today disrupted over the issue of removal of Trinamool Congress's leader and the Railway Minister, Mr.Dinesh Trivedi from the Council of Ministers.</p><br clear="all" />
]]>
i want to display like this,
Parliament was today disrupted over the issue of removal of Trinamool Congress's leader and the Railway Minister, Mr.Dinesh Trivedi from the Council of Ministers.
can anyone tell the idea to do this. thanks.
do it as below:
String plain = Html.fromHtml("your_html_string").toString();
html = html.replaceAll("<(.*?)\\>"," ");//Removes all items in brackets
html = html.replaceAll("<(.*?)\\\n"," ");//Must be undeneath
html = html.replaceFirst("(.*?)\\>", " ");//Removes any connected item to the last bracket
html = html.replaceAll(" "," ");
html = html.replaceAll("&"," ");
Here is a piece of my code.
This might work:
myHtmlString.replaceAll("s/<(.*?)>//g","");
Or
Html.fromHtml(htmlSrc).toString();
But there can be some bugs on the last one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With