Displaying HTML content in BrowserField not working perfectly in blackberry
i solved my problem which i asked here. Actualy the problem is not exactly in parsing, but problem is in url creation. :)
Now i have an another problem, i.e. data which i g开发者_高级运维et using parsing have HTML tags, I used BrowserField to display HTML content. but this works fine in simulator, and not running perfectly on device...
problem facing on device is FONT SIZE problem.
can anybody help me to solve this problem
Thanx in advance!!!
Try this code to skip Html tags...
public String HtmlRemove(String s)
{
char[] cs = s.toCharArray();
StringBuffer sb = new StringBuffer();
boolean tag = false; for (int i=0; i<cs.length; i++)
{
switch(cs[i])
{
case '<':
if ( ! tag)
{
tag = true;
break;
}
case '>':
if (tag)
{
tag = false;
break;
}
break;
case '&':
if ( ! tag)
{
tag = true;
break;
}
case ';':
if (tag)
{
tag = false;
break;
}
break;
default:
if ( ! tag) sb.append(cs[i]);
}
}
return sb.toString();
}
This will surely help you
精彩评论