×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    5

    getAppProperty() doesn't work with user attributes?

    Hello Forum,

    I have set up a J2ME environment for developing Nokia Series 40 MIDlets:
    JDK 1.4.2.09
    NDS for j2me 3.0
    Eclipse 3.1
    Nokia_s40_dp20_sdk_6255

    I have imported the MediaPlayer sample (src and res directories) from Nokia into a newly created Eclipse Project

    In Eclipse, you can set user attributes that can be aquired at run-time by the MIDlet class. It is in
    Tools->Nokia Developer suite for J2ME->New Application Package...->User Attibutes tab.

    I understand that these attributes will make it into the jad file. You can access them in the MIDlet class by getAppProperty(....).
    But this doesn't work with the user attributes

    Let's say, I have defined:
    Test:Hello
    (key=Test, value=Hello, that is)

    I have checked it, it really got into the jad file. I have copied another jad file from a Nokia sample project (MediaSampler). I have hand-edited the jad file. Nothing worked.
    However, using a pre-defined attribute, e.g. MIDlet-Name worked fine. Here is a code snippet:

    // the MIDlet class constructor
    public MediaSamplerMIDlet()
    {
    // All user attributes don't work
    String AMR_Audio_Clip = getAppProperty("AMR-Audio-Clip");
    String WAV_Audio_Clip = getAppProperty("WAV-Audio-Clip");
    String MIDI_Audio_Clip = getAppProperty("MIDI-Audio-Clip");
    // Pre-Defined attribute works fine
    String Test = getAppProperty("MIDlet-Name");

    Stepping through this code in the debugger, all strings remain null, except for Test.

    Why doesn't this work with user attributes?

    Any help would be great

    je35

  2. #2
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: getAppProperty() doesn't work with user attributes?

    When you refer to 'the jad' file that you have 'hand-edited' are you actually referring to the Manifest.MF file?? Can you confirm what is actually in your Manifest.MF file?

    Viru Doshi
    ~ No Style Without Substance ~

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    5

    Re: getAppProperty() doesn't work with user attributes?

    Hi Viru,

    I didn't hand-edit the manifest.mf, just the jad file. I thought that this will be managed by Eclipse.
    Nevertheless, I have looked into the the Manifest.mf generated by Eclipse. It is in the ./preverified-temp/META-INF sub directory under the project directory.
    The Test attribute key was there, but it had a different value. I changed the value to be *exactly* the same as in the jad file, i.e. "Hello". I debugged again, but the problem remains, I still get a null from getAppProperty("Test").
    Finally, I checked into both the jad and the manifest if Eclipse had overwritten the file. It didn't.

    When I built the application package, Eclipse reported a problem with the resource path.
    Could it be that Eclipse has a problem with the resources since they are not in the resource path? Where can I set the resource path? I have set the classpath to the \res sub directory, but this didn't help.

    je35

  4. #4
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: getAppProperty() doesn't work with user attributes?

    To confirm that there isnt a problem in your code, can you test and confirm if you do something like;

    System.out.println("MIDlet Vender: " + getAppProperty("MIDlet-Vendor"));

    Where in your Manifest.MF and jad file have identical attributes, i.e.

    MIDlet-Vendor: ViruDoshiInc.

    Just a little test to make sure you're getting the correct value back.

    Viru Doshi
    ~ No Style Without Substance ~

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    5

    Re: getAppProperty() doesn't work with user attributes?

    Hi Viru,

    Funny thing: I tried your test with MIDlet-Vendor set to MyCompanyWritingMIDlets, but the MIDlet-Vendor remains "unknown". It seems that the MIDlet doesn't recognize my attribute (or property) changes in Eclipse even if they appear in the jad file. In the Manifest.MF created by Eclipse, the MIDlet-Vendor still is MyCompany.

    I guess I should abandon Eclipse for j2me. The integration with NDS3 seems buggy to me. I will probably try Sun's WTK (and some sort of better notepad like UltraEdit). What IDE is most recommended?

    I realize that I have to register if I try to use stand-alone NDS. How do I get a serial? Do I have to pay for it. It doesn't seem to recognize my installation serial (and or my forum user name).

    je35

  6. #6
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: getAppProperty() doesn't work with user attributes?

    In my opinion the best Java IDE i've used it Borland's JBuilder. I'm using JBuilder X, so if you have the money i suggest buying it!!

    The serial for NDS is free, i registered over the net using my forum username.

    Viru Doshi
    ~ No Style Without Substance ~

  7. #7
    Registered User
    Join Date
    Nov 2005
    Posts
    5

    Re: getAppProperty() doesn't work with user attributes?

    Hi Viru,

    thanks again for your help.
    I will check out if I get JBuilder.
    Meanwhile, I have found out that Eclipse (or the Nokia Emulator) uses another jad file. This is the Output in the Eclipse Console tab when I run the MIDlet:

    Could not connect to NCF!
    Emulator command: C:\Nokia\Devices\Nokia_Prototype_SDK_2_0\devices\Prototype_2_0_S40_MIDP_Emulator\bin\midp.exe -Xdescriptor "D:\Profiles\joe\Lokale Einstellungen\Temp\ueiemulator18564.tmp\MediaSampler.jad"

    I didn't find out how to use the correct jad file:
    c:\projects\eclipse_prj\MediaSampler>MediaSampler.jad

    Actually, I don't know why Eclipse has to use a temporary directory at all.

    Now I have at least registrated successfully. The serial is not the serial I got for installing NDS, but you need another one that is even longer

Similar Threads

  1. Error when getting user defined properties (getAppProperty) Nokia 6260
    By rikard_wigforss@hotmail.com in forum Mobile Java General
    Replies: 2
    Last Post: 2005-04-20, 19:50
  2. Settings Lists - Allows User Defined Entry
    By leethomso in forum Symbian User Interface
    Replies: 6
    Last Post: 2004-11-24, 17:04
  3. Using the emulator as a restricted user
    By fcastanar in forum Symbian
    Replies: 0
    Last Post: 2004-10-28, 03:58
  4. Replies: 1
    Last Post: 2002-05-24, 06:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×