0

I am running Eclipse pulsar with S60 SDK (Emulator) on win7 machine.

I tried using LWUIT library components i.e HtmlComponent , BrowserComponent. In BrowserComponent: as i found from sources that it works only if NativeBrowserisSupported() but it returns false and when try to instantiate fire an error.

In HtmlComponent: as i worked with it i found it doesn't load css from external sources it fires an error i posted that question Link no proper answers.

i aslo tried by using following approach with HtmlComponent

HTMLComponent htmlComp = new HTMLComponent();
        htmlComp.setPreferredH(450);
        htmlComp.setPreferredW(150);
htmlComp.setBodyText(" <body background='/images/profile_image.png'>  Hi how r you..? <div background='/images/profile_image.png'>  Hey i'm fine..!</div> </body>");

the image is in my projects images folder.but not displaying background image, from doc that it supports background img it's wrong.

I also tried this i.e. supplying DocumentRequestHnadler() interface implementation and then supply the original htmlcard string which contains link to external css, but gives error, code for DocumentRequestHandler() implementation provided in this question Link no proper answers.

I also chage my htmlCard string and give all it's css inline and in another case make it internal css but still not showing anything. Related css just download images because of DocumentRequestHandler() implementation.

Also tried using SWT Browser but it's not taking background images which are supplied in html code take a look,

Browser browser = new Browser(shell, SWT.NONE);
            browser.setBounds(50, 50, 300, 400);
            browser.setVisible(true);
browser.setText("<html><head></head><body background='/images/profile_image.png'> <div background='/images/profile_image.png'>Hi i'm jayesh..!</div></body></html>");

Is any buddy done this before please help..

Community
  • 1
  • 1
MobileEvangelist
  • 2,583
  • 1
  • 25
  • 36

1 Answers1

0

You most probably weren't formatting your CSS properly. This inline css works fine.

 HttpRequestHandler handler = new HttpRequestHandler(); 

        htmlC = new HTMLComponent(null); //new ExtHTMLComponent(handler);
        htmlC.setUIID("HtmlContainer");
        htmlC.setBodyText("<div style=\"background-color: pink; padding: 5px;\">Finance & Account Manager at Nestoil PLC</div>");
Ajibola
  • 1,218
  • 16
  • 28
  • ya.. i tried did this one but it's not working with images, i.e. if we set background image to body. (first tried internal image, after that tried for url which returns image" – MobileEvangelist Sep 03 '12 at 08:21
  • how big is the image, it may be better to use the resource editor to set the image background of the HTMLComponent, though i know styling that component can be tricky. – Ajibola Sep 03 '12 at 09:07
  • I'm receiving image from url at the same time setting as background to html card, and having list of html card. And in your code you haven't mention HttpReqiestHandler for HTML component (as it's use for handling I/O) we have to access images in code from external resources(links). oh!. sorry for delayed reply. – MobileEvangelist Sep 03 '12 at 13:49
  • Basically if you download the image, then you can set the style of the component/form in code with the downloaded image. – Ajibola Sep 10 '12 at 23:26
  • actually i receive html string which contains link to External CSS file. When we pass that to HTML Component Handler it tries to load it and at then it fails, If you have any working code that helps me to understand it in better way or any tutorial link appreciable. – MobileEvangelist Sep 17 '12 at 05:50