View Single Post
Old 09-18-2009, 01:42 AM   #2 (permalink)
kelumkps
New Member
 
Join Date: Apr 2009
Model: 8800
PIN: N/A
Carrier: Software developer
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can implement javax.microedition.io.HttpConnection interface so that it takes your text like this.

Code:
public class HttpConnectionImpl implements HttpConnection {
private DataInputStream dataInput;
private InputStream in;
private String encoding = "text/html";

public HttpConnectionImpl(String text) {
try {
in = new ByteArrayInputStream(text.getBytes("UTF-8"));
dataInput = new DataInputStream(in);
} catch (Exception e) {
System.out.println("HttpConnectionImpl : Exception : " + e);
}

}

// implement rest of the methods of HttpConnection interface with dummy methods


}

Then you can pass an object of this implementation to get the field as follows;

Code:
String text= "This is a test.";

HttpConnection connection = new HttpConnectionImpl(text);

renderingSession = RenderingSession.getNewInstance();

renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.SHOW_IMAGES_IN_HTML, false);

BrowserContent browserContent = renderingSession.getBrowserContent(connection, null, null);

Field field = browserContent.getDisplayableContent();


Regards,

-Kelum-
Offline   Reply With Quote