J2ME : How to get data from listing menu

Hello,
I'm new in J2ME. I need your help to solve my problem.

I use php to retrieve data from mysql to my j2me application the outcome is in lists of data.
After I get a list of data, the list can be selected for data details.

String A
String B
String C

if using this command, index = listInfo.getSelectedIndex();  
the result is only index data in interger

After selected String A, what command should i use in order that i can get "String A" data in text not just the index.

Thank you
Best regards
eddysusantoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

eddysusantoAuthor Commented:
import javax.microedition.lcdui.*;
import java.io.IOException;

class jadwaljktyog extends Form implements CommandListener  {
      private Inkarta inkarta;
      private Display display;
      private TextField kodeField;
      private Command detailCommand;
      private Command kembaliCommand;
      private Command keluarDetailCommand;
      private List listInfo;
      private Form formDetail;
      private Form infoForm;

      String kodea, coba, dapatStatus, olehStatus, ada, km, hsl, subyek;

      int index, jumlah, awal;
      Image infoImage;

      String url = null;

      jadwaljktyog (Inkarta inkarta) {
            super ("Info Jadwal JKT-YOG Yg Ada");
            this.inkarta = inkarta;
            ada = null;
            dapatStatus = null;
            olehStatus = null;
            display = Display.getDisplay (inkarta);

      }

public void awal()
      {
            url = "http://localhost/inkarta/j2me/jadwaljktyog.php";
            inkarta.koneksi(url);
            km=inkarta.hasilStatus;
            if (km.equals("NO"))
            {
                  infoForm = new Form("Info");
                  infoForm.append("Tidak ada Info");
                  kembaliCommand = new Command("Back", Command.CANCEL, 1);
                  infoForm.addCommand(kembaliCommand);
                  infoForm.setCommandListener(this);
                  display.setCurrent(infoForm);
         }
         else
         {
            jumlah=km.length();
            awal=0;
            listInfo = new List("Pilih",List.IMPLICIT);

                  int ulang;
                  for (ulang = 0 ; ulang < jumlah; ulang++)
                  {

                        hsl=km.substring(ulang,ulang+1);
                        if (hsl.equals(","))
                        {
                              subyek=km.substring(awal,ulang);
                              awal=ulang+1;
                                listInfo.append (subyek, null);
                        }

                  }

            kembaliCommand = new Command("Back", Command.CANCEL, 1);
            listInfo.addCommand(kembaliCommand);
            detailCommand = new Command("Detail", Command.OK, 2);
            listInfo.addCommand(detailCommand);
            listInfo.setCommandListener(this);
            display.setCurrent(listInfo);
            }
      }

    public void infoDetail()
      {
            url = "http://localhost/inkarta/j2me/dtljadwaljktyog.php?kode="+kodea;  << I need string for variabel kodea
            inkarta.koneksi(url);
            formDetail =new Form("Detail Info");
            formDetail.append(inkarta.hasilStatus);
            keluarDetailCommand = new Command("Back", Command.CANCEL, 3);
            formDetail.addCommand(keluarDetailCommand);
            formDetail.setCommandListener(this);
            display.setCurrent(formDetail);
      }

      public void commandAction(Command c, Displayable d)
      {
            if (c == kembaliCommand )
        {
                   inkarta.infojadwalkaCancel();
        }
        else if (c == detailCommand )
        {
                  index = listInfo.getSelectedIndex();
                  kodea= ??? <<<<<<< THIS line .. I don't know what syntax I should use
                      infoDetail();
        }
        else
        {
                  awal();
            }
    }
}
0
bgloddeCommented:
Try this:

index = listInfo.getSelectedIndex();
kodea = listInfo.getText(index);
0
eddysusantoAuthor Commented:
I got error msg with that line

Building "Inkarta"
c:\WTK104\apps\Inkarta\src\keterlambatanjktyog.java:96: cannot resolve symbol
symbol  : method getText  (int)
location: class javax.microedition.lcdui.List
                  kode = listInfo.getText(index);
                                            ^


0
bgloddeCommented:
I'm sorry, that should be getString(index);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eddysusantoAuthor Commented:
wow ... that's the answer
Thank you very much

Best regards
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Wireless Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.