Display simple HTML in a native BlackBerry application
Make sure that you launch the MDS simulator before launching the device simulator. All or most of the samples that use HTTP don't specify a transport and so will use the default MDS transport, which means if you don't have MDS simulator running then it won't be able to make an HTTP connection.
How to show html text in BlackBerry?
You can use a BrowserField to render content in your application as a Field. In order to render HTML provided as a String rather than a URL, see this answer which involves mocking an HttpConnection.
Displaying HTML content in a Field in blackberry
You can just eval
the JSON response, though for better security adding JSON parsing support is fairly simple, try the json2.js library. Then just use normal JS notation to extract your HTML string and insert it into your text field.
Note that:
- The Blackberry browser didn't support XMLHttpRequest until 4.6, for example the Curve 8310 does not support it.
- Javascript is not enabled by default on the Blackberry browser, if you have corporate setup you can enable it through an MDS policy rule
- If you've got the above two covered, be careful with Javascript libraries as you can easily exhaust the device memory simply interpreting them (with less than 300k of JS IMX)
Blackberry - How to print HTML String in a field
If you need to support only RIM OS 5.0.0 and greater you can use BrowserField.displayContent method.
Othervice try BrowserFieldDemo & HttpConnection mockup approach
Embedded HTML control for Blackberry?
Yes. Check out the net.rim.device.api.browser.field package or the Blackberry Browser section of application integration.
Everything sort of finishes here:
Field field = browserContent.getDisplayableContent();
See:
JDE 4.0.0 API for the package
RIM app integration guide
Signed only api, as usual.
Displaying HTML content in BrowserField not working perfectly in blackberry
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
Related Topics
How to Make a Div 100% of Window Height
Difference Between HTML and Dom
Ring-Shaped Process Spinner with Fading Gradient Effect Around The Ring
Indent Starting from The Second Line of a Paragraph with CSS
Making Youtube.Com/Embed Urls Work on iOS
Brackets Displays Wrongly for Right to Left Display Style
Post Request to Include 'Content-Type' and JSON
Cannot Undo Text-Decoration for Child-Elements
Which Unit I Should Use in CSS When Designing a Web Page
CSS Right Margin Does Not Work Inside a Div with Overflow Scroll
Change Navbar Breakpoint in Bootstrap 3.3.2
Onerror Event Using Background: Url()
Why Do HTML Entity Names with Dec < 255 Not Require Semicolon