MIDlet: How to read configuration?

Discussion in 'Java' started by Simon Brooke, Oct 11, 2006.

  1. Simon Brooke

    Simon Brooke Guest

    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.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    Morning had broken, and there was nothing we could do but wait
    patiently for the RAC to arrive.
     
    Simon Brooke, Oct 11, 2006
    #1
    1. Advertising

  2. Simon Brooke

    Simon Brooke Guest

    in message <>, Simon Brooke
    ('') wrote:

    > 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.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    ;; Diplomacy, American: see Intelligence, Military
     
    Simon Brooke, Oct 12, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    0
    Views:
    863
  2. Ante

    Bluetooth MIDlet

    Ante, Jul 1, 2003, in forum: Java
    Replies:
    3
    Views:
    6,805
    Darryl L. Pierce
    Jul 2, 2003
  3. ScOe

    Re: MIDlet problem

    ScOe, Aug 12, 2003, in forum: Java
    Replies:
    3
    Views:
    446
    Darryl L. Pierce
    Aug 16, 2003
  4. Me
    Replies:
    1
    Views:
    423
    Darryl L. Pierce
    Sep 8, 2003
  5. Talal Itani
    Replies:
    5
    Views:
    3,682
    Darryl L. Pierce
    Feb 25, 2007
Loading...

Share This Page