MIDlet: How to read configuration?

S

Simon Brooke

OK, I'm trying to learn how to build a MIDlet. I'm an experienced
server-side Java programmer, but I'm new to Micro Edition. The problem I'm
looking at just now is how do I read configuration for the MIDlet at
startup time?

In the MIDlet package as I understand it, I don't have java.io.File, and I
don't have java.util.Properties, so I can't do

Properties config = new Properties()
config.load( new FileInputStream( new File( CONFIGFILENAME)));

I have a whole variety of configuration variables which I don't want to
hardcode in the MIDlet, and which it isn't reasonable to expect the user
to key in on some crappy mobile phone keypad each startup. So there must
be an easy way to do this...

I need the configuration file to be easy to maintain, so a simple text file
like a Java properties file stored in a resource seems to me the best
solution.
 
S

Simon Brooke

Simon Brooke said:
OK, I'm trying to learn how to build a MIDlet. I'm an experienced
server-side Java programmer, but I'm new to Micro Edition. The problem
I'm looking at just now is how do I read configuration for the MIDlet at
startup time?

D'oh!

Just in case anyone does a google search on this question some time in the
future, the answer is you store config as name/value pairs in the
application descriptor (jad) file, and access them using

getAppProperty( String)

See
http://developers.sun.com/techtopics/mobility/midp/ttips/getAppProperty/

I have to say I discovered this after /completely/ reinventing the wheel
using rms.

Sorry for asking damn fool questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top