Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    Experts.,

    I created 10 stringItem dynamically. I did setDefaultCommand(cmd) and setItemCommandListener(this).

    my code is like
    Code:
     for (int i = 0; i < 10; i++) {
            
                newsTitle = new StringItem(null, stringNews[i]);
                this.append(newsTitle);
                newsTitle.setDefaultCommand(cmdNext);
                newsTitle.setItemCommandListener(this);
            }
    In CommandAction, code is like

    Code:
    public void commandAction(Command c, Item item) {  
            if(c == cmdNext){
                   Display.getDisplay(mainPage).setCurrent(new frmNewsDetials(newsTitle.toString(), mainPage));
            }
        }
    When i click the stringItem, i get only the last index. of the title.


    how can i get the particular index value of particular click action...?

    Help me,
    kumar.

  2. #2
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    You are assigning same name to all string items so it is trated as array and the last item of array is shown try appending index in the name of an item so now by that you will be able to acess the particular index value

  3. #3
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    Thanks for your reply, I'm doing this dynamically. so only i did same name for stringItem. ya, i get only last index of the stringItem.

    could u elaborate how to get the particular index by code..?

  4. #4
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    Create a counter and whenever a new stringitem created count get increamented and add this now to stringitem name like wise
    for first stringitem item will be stringitem1,
    stringitem2 likewise..

Similar Threads

  1. StringItem button
    By kumar1234567 in forum Mobile Java General
    Replies: 1
    Last Post: 2011-05-06, 07:31
  2. StringItem button
    By kumar1234567 in forum Mobile Java General
    Replies: 1
    Last Post: 2011-05-06, 07:27
  3. How can I add interactivity to a StringItem with appearance mode HYPERLINK or BUTTON?
    By nikhil_shravane2004 in forum Mobile Java Tools & SDKs
    Replies: 11
    Last Post: 2010-06-30, 06:26
  4. 6600 bug: adding Command to BUTTON StringItem crashes JVM
    By lgdean in forum Mobile Java General
    Replies: 1
    Last Post: 2004-04-19, 20:43
  5. Replies: 1
    Last Post: 2004-04-19, 20:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved