Forums Register Login

Loading properties file

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 ]
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2014 times.
Similar Threads
JAR + Properties
Client side image uploading from server servlet
loading modified properties file automatically
Save properties
hi helpme
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:31:49.