Building a WAP browser in J2me

I’m pondering upon implementing a WAP browser in J2ME. I gave it a quick try using the HttpConnection and the kXML2 library for parsing XML and “so far so good” but I really need some input upon the feasability of this project.

  1. Should I try using the standard “Form” displayable and adding StringItems et cetera as necessary? That would probably get me a long way but I am afraid I will run into unforseen problems which gives me option 2)

  2. Implement it as a Canvas, do everything myself and therby get more or less full control of all the elements.

Anyone got any inputs on potential pitfalls on any of the above methods?

I have tried using WebViewer (http://www.reqwireless.com/webviewer.html) which is a really amazing piece of software. I’m hoping to end up with something like that.

I would do it on a Canvas. But that’s more of a personal thing - I like to have low level control of things, and implementing the high level widgets isn’t too much trouble. The problem with Forms is that they’re a bit unpredictable. For simple things they work great but if you try to get clever, the different implementation details that change from phone to phone might muck things up a bit.

shmoove

Niklas,

Please keep me up to date of how you’re going with the development and if you need any help on specific matters.

We’re currently interested in such a project.

Regards

Cellectivity

Just a quick update for cellectivity and anyone else that might be interested. I researched the Form based approach (and actually managed to build a working browser for both WML and X/HTML within that framework) but as shmoove already pointed out it gives unpredictable results, is limited and adds alot of unnecessary constraints.

The GameCanvas approach is ofcourse more work (but not really alot more) but is extremely portable between devices (especially coupled with a build process such as that from j2mepolish.org).

You would only need Canvas, not GameCanvas.

p.s.

From a portability point of view, you should also be aware that relying on g.drawString(…) can be problematic.
Many phones have font issues (either incomplete character sets, issues with particular characters, ridiculously large fonts, peculiar alignment issues, or incorrect stringWidth(…) values)