Results 1 to 5 of 5
  1. #1
    ciara is offline Member
    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Default Trying to get a list that goes on to show images

    Iam creating a app that starts as a list once u choose one off the list items it would show you 3 images. iam very new to programming. And i will take all the help i can get please and thank you. What are some ways I can do it does anyone have any suggestions
    Last edited by ciara; 12-05-2012 at 02:30 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please help anyone please

    Quote Originally Posted by ciara View Post
    Iam creating a app that starts as a list once u choose one off the list it would show you 3 images. iam very new to programming. And i will take all the help i can get please and thank you. This is what i have so far:...
    Suggestions for allowing us to better be able to help you:
    • Please edit your posted code above and wrap that code in [code][/code] tag. The first tag goes on top of the code block, and the second tag goes at the bottom of your post below the posted code block.
    • Please ask an actual answerable question. You haven't yet explained what help you need exactly, what is wrong with your current code,... etc. The more you can tell us, the better we'll know what to do.
    • Please edit your initial post and click on the "Go Advanced" button and change the title of your forum thread. This title is supposed to be short and informative, a summary of your problem. "Please help anyone please" is not very informative and doesn't tell us in a nutshell what is wrong.


    Much luck!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Trying to get a list that goes on to show images

    Quote Originally Posted by ciara View Post
    Java Code:
    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class Travel extends MIDlet implements CommandListener
    {
    ...
    }
    Moved from New to Java.

    Please go through the Java coding conventions and learn how to format your code for readability.

    Quote Originally Posted by ciara View Post
    the app doesn't run at all
    How, exactly, did you try to run it? Also, do you have the author's permission to reproduce the code on a public forum?
    Cascaded List

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Trying to get a list that goes on to show images

    Please don't delete your posts. I will repost your code for the benefit of future visitors to this site:

    You state:
    Iam creating a app that starts as a list once u choose one off the list items it would show you 3 images. the app doesn't run at all but i cant seem to find out what is wrong. iam very new to programming. And i will take all the help i can get please and thank you. This is what i have so far:
    And post this code:
    Java Code:
    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class Travel extends MIDlet implements CommandListener
    {
    private Display d;
    private List mlist,mlist1,mlist2,mlist3;
    private Command mExit,mNext,mBack;
    private Alert alert1,alert2,alert3;
    private Image pcnyc,pcnyc1,pcnyc2, tah,tah1,tah2, teh1,teh2,teh3; 
    
    public Travel()
    {
    d=Display.getDisplay(this);
    mlist=new List("Hotel LIST",List.IMPLICIT);
    mlist.append("Park Central New York Hotel",null);
    mlist.append("The Algonquin Hotel",null);
    mlist.append("The Edison Hotel ",null);
    
    
    String str1[]={"/mobile.png","JetGo","Spice","AirIndia"};
    
    String str2[]={"Indigo","Santro","Skoda","Benz"};
    
    String str3[]={"Mangla","Rajdhani","Deccan Queen","Sahyadri"};
    
    
    
    mlist1=new List("Aeroplane LIST",List.IMPLICIT,str1,null);
    mlist2=new List("Car LIST",List.IMPLICIT,str2,null);
    mlist3=new List("Train LIST",List.IMPLICIT,str3,null);
    
    try{ 
    pcnyc = Image.createImage("pcnyc.png"); 
    pcnyc1 = Image.createImage("pcnyc1.png"); 
    pcnyc2 = Image.createImage("pcnyc2.png"); 
    tah = Image.createImage("tah.png"); 
    tah1 = Image.createImage("tah1.png"); 
    tah2 = Image.createImage("tah2.png"); 
    teh1 = Image.createImage("teh1.png"); 
    teh2 = Image.createImage("teh2.png");
    teh3 = Image.createImage("teh3.png");
    }catch(Exception e){ 
    System.err.println(e.getMessage()); 
    } 
    
    mExit=new Command("EXIT",Command.EXIT,0);
    mNext=new Command("NEXT",Command.SCREEN,1);
    mBack=new Command("BACK",Command.BACK,1);
    
    
    
    mlist.addCommand(mExit);
    mlist.addCommand(mNext);
    mlist.setCommandListener(this);
    
    mlist1.append(null, pcnyc);
    mlist1.append(null, pcnyc1);
    mlist1.append(null, pcnyc2);
    mlist1.addCommand(mBack);
    mlist1.addCommand(mNext);
    mlist1.setCommandListener(this);
    
    mlist2.append(null, tah);
    mlist2.append(null, tah1);
    mlist2.append(null, tah2);
    mlist2.addCommand(mBack);
    mlist2.addCommand(mNext);
    mlist2.setCommandListener(this);
    
    mlist3.append(null, teh1);
    mlist3.append(null, teh2);
    mlist3.append(null, teh3);
    mlist3.addCommand(mBack);
    mlist3.addCommand(mNext);
    mlist3.setCommandListener(this);
    
    
    }
    public void startApp()
    {
    d.setCurrent(mlist);
    }
    public void pauseApp()
    {
    }
    public void destroyApp(boolean b)
    {
    }
    public void commandAction(Command c,Displayable s)
    {
    
    if(c==mExit)
    {
    notifyDestroyed();
    }
    if (c==mNext || c==List.SELECT_COMMAND)
    {
    int index=mlist.getSelectedIndex();
    if(index==0)
    {d.setCurrent(mlist1);
    int index1=mlist1.getSelectedIndex();
    if (c==mNext)
    {
    
    alert1 =new Alert("OPTION SELECTED","U CHOSE "+mlist1.getString(index1),null, null);
    alert1.setTimeout(Alert.FOREVER);
    d.setCurrent(alert1);
    }
    }
    if(index==1)
    {d.setCurrent(mlist2);
    if (c==mNext)
    {
    int index2=mlist2.getSelectedIndex();
    alert2 =new Alert("OPTION SELECTED","U CHOSE "+ mlist2.getString(index2),null,null);
    alert2.setTimeout(Alert.FOREVER);
    d.setCurrent(alert2);
    }
    }
    if(index==2)
    {d.setCurrent(mlist3);
    if (c==mNext)
    {
    int index3=mlist3.getSelectedIndex();
    alert3 =new Alert("OPTION SELECTED","U CHOSE "+mlist3.getString(index3),null,null);
    alert3.setTimeout(Alert.FOREVER);
    d.setCurrent(alert3);
    }
    }
    if (c==mBack)
    {
    d.setCurrent(mlist);
    }
    }}}

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Trying to get a list that goes on to show images

    In view of ciara removing content and not replying to responses, I'm closing this thread.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

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