Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading properties file

 
Kobe Phenom
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to load an image in my midlet but i want to set the path of my image in a properties file.can anyone help me how or perhaps give me an example on how to load a properties file?thanks in advance.
 
David Price
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MIDP APIs don't have any special support for property files, so you'll need to just open the property file as an InputStream and then parse it yourself:

You might find it more convenient to add some of your own properties to your MIDlet JAR file's manifest, or to the MIDlet JAD file: you can then read them using the method getAppProperty of class MIDlet. Here's an example from one of my MIDlet JAD files:

Then my MIDlet constructor just does:

You'll have no problems if you just add a few properties. But phones reasonably expect the JAD file to be small, so if you add very large amounts of properties you may run into problems on real phones.
[ November 02, 2003: Message edited by: David Price ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic