[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kvm-interest
Subject:    Re: How determine MIDlet's sequence number in MIDlet Suite?
From:       Rolf Sponsel <Rolf.Sponsel () KSTR ! LTH ! SE>
Date:       2001-08-31 14:33:21
[Download RAW message or body]

Thanks all!

Please have the code:

private int indexApp()  // MIDlet's index in descriptor/manifest file
{       // Note! Requires MIDlets to be of different class though :-(
  String propValue = " ";
  for (int i = 1; propValue != null; ++i) {
    if ((propValue = getAppProperty("MIDlet-"+i)) != null
    &&  propValue.endsWith(getClass().getName()))
      return i;
  }
  throw new IllegalStateException(); // i.e. MIDlet-# property missing
}

Note! The code, unfortunately, cannot handle the situation when
      multiple MIDlets are of the same class, e.g. if you wanted
      the MIDlets index to act as a shortcut to a certain state.

Cheers / Rolf

Gary Adams - SMI Software Development wrote:
>
> Loop through the properties in the descriptor or manifest file
>   getAppProperty("MIDlet-" + i )
>
> and parse the MIDlet class name from the last comma separated field
>

Rolf Sponsel wrote:
> >
> > Does someone know if it is possible for a running MIDlet
> > to programatically determine it's sequence number in the
> > MIDlet Suite.
> >
> > I.e. That the MIDlet can find out that it is define , e.g.
> > as number two, via the MIDlet-2 property in the descriptor
> > file (and manifest).

--
----
------
--------

Rolf Sponsel

___________________________________________e_n_d___o_f___m_e_s_s_a_g_e_

 ==========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic