Hello,
I use these forums all of the time and they are excellent in helping to resolve the many problems a J2ME programmer faces. Up until now I have not had to post any of my own questions as with a bit of time spent searching you can usually find the answer that you are looking for.
The following questions are ones that from all my searching have not been completely answered and I am wondering if anyone can fully answer them for me.
I am mainly developing for the series 60 platform so these questions are mainly for this platform:
1. I use the Nokia UI API to draw transparent polygons in my code all of the time and that is the only external piece of code that I require and apart from that my code is pure java. I was wondering if there is any way of coding your own transparent polygon code and if so which way you would go about it? I require this as I am starting to look at phones that will not support this UI and it would be useful to have a pure java version of my program.
2. Once I have obfuscated my code using proguard and then packaged it into a jar file it comes to roughly 150k. After then re-compressing it using WINRAR it takes the jar size down a further 20k. This would be a great decrease for me but when I try to run it on an emulator it fails to find any of the resources(i.e. the logo doesnt apear in the startup menu) and when the application is trying to load it says "class not found exception". I realise this must be something to do with the way WINRAR must have compressed the class files and their names etc but the main class file(midlet) still has the same name - it also has not been changed when it was obfuscated. I was wondering if anyone has managed to successfully use WINRAR in this way and if they could point me in the right direction in how to do so as this is a very interesting development for me as heap memory is critical in my program?
3. There seems to be a lot of conflicting posts regarding whether to use System.gc()'s or Runtime.getRuntime().gc()'s not and also when to use them. What is the difference between the two? Should they be called as much as possible as speed is not a great issue in my program but heap memory is? When is the best time to call them in your program that would free up most heap memory?
4. Is there a best place to NULL variables in a series 60 application, and if they are NULLED can that space not be used again? If so is this the same accross all different platforms or only series 60?
5. For heap memory is it better to define a lot of class variables in your code or is it better to keep as many variables local to your class methods as possible?
6. Finally, has anyone came up with a proper solution to the reading in a textfile bug on series 60 that uses up more heap memory than it should? This would be a great advantage as there are many hard-coded strings in my program and I would like to organise these into textfiles. Is it also possible to create text compression code that would reduce the jar size and wouldnt drastically use up heap memory once it has been loaded in?
I know there are a lot of questions and that you may not be able to answer them all without having more information about my program, but any advice or answers would be most greatly welcomed - prefferably if they are not conflicting!
Many Thanks,
Jon

Reply With Quote

