×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    Dynamically adding elements & commands to a List (type javax.microedition.lcdui.List)

    During runtime I'm able to add elements to a List using getResultList().append(String str). But how do I attach commands to these newly added elements so they do something when selected? The List type I'm using is IMPLICIT.

    The reason I'm asking is because my app needs to dynamically create screens based on the data it receives from the mobile network.

    Thanks in advance!

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: Dynamically adding elements & commands to a List (type javax.microedition.lcdui.L

    You could follow the default suggestion for IMPLICIT lists: http://docs.oracle.com/javame/config...cdui/List.html, and use setSelectCommand+getSelectedIndex.

  3. #3
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Dynamically adding elements & commands to a List (type javax.microedition.lcdui.L

    ok, when you are saying " But how do I attach commands to these newly added elements so they do something when selected? " I immediately think about a real Command, as in http://docs.oracle.com/javame/config...i/Command.html
    Or are you implying that a newly added List item should simply react on it being selected ? So no real Command is added to your List/From...
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  4. #4
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    Re: Dynamically adding elements & commands to a List (type javax.microedition.lcdui.L

    Thanks wizard_hu_, I'll take a look at your suggestion. Tiger79, yes I'm talking about a real Command. I'm able to add elements to a List during runtime but I'm not sure how to assign actions to these List elements, i.e. how to make them react to presses etc. Thanks
    Last edited by Infms; 2012-12-10 at 19:03.

  5. #5
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Dynamically adding elements & commands to a List (type javax.microedition.lcdui.L

    well when adding a List item you can always do the following :
    listName.addCommand(aCommand);
    listName.setCommandListener(this);

    and then implement public void commandAction(Command c, Displayable d).

    A simple and nice tutorial might be :
    http://www.java-samples.com/showtuto...tutorialid=731
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Dynamically adding elements & commands to a List (type javax.microedition.lcdui.L

    Quote Originally Posted by Infms View Post
    how do I attach commands to these newly added elements so they do something when selected? The List type I'm using is IMPLICIT.
    List.IMPLICIT plus Command.ITEM are not compatible with the latest touch enabled devices of the Nokia Series 40 Platform. Please, see this for alternatives …
    Last edited by traud; 2013-02-04 at 12:46.

Similar Threads

  1. Original Source Code of javax.macromedia.lcdui.List
    By rahul.kulshreshtha in forum Mobile Java General
    Replies: 8
    Last Post: 2010-05-18, 07:36
  2. Problem in javax.microedition.lcdui.List.deleteAll()
    By dandekar.abhay in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2009-01-02, 12:13
  3. javax.microedition.lcdui.List and unexpected IndexOutOfBoundsException
    By patrick@onestep.co.uk in forum Mobile Java General
    Replies: 0
    Last Post: 2008-03-14, 16:56
  4. Text wrapping in javax.microedition.lcdui.List
    By DrChandra in forum Mobile Java General
    Replies: 4
    Last Post: 2006-04-15, 01:21
  5. App Closed javax.microedition.lcdui...
    By jinesh_l in forum Mobile Java General
    Replies: 3
    Last Post: 2005-09-10, 13:53

Posting Permissions

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