Results 1 to 5 of 5
- 12-05-2012, 06:12 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 1
- Rep Power
- 0
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.
-
Re: Please help anyone please
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!
- 12-05-2012, 07:26 AM #3
Re: Trying to get a list that goes on to show images
Moved from New to Java.
Please go through the Java coding conventions and learn how to format your code for readability.
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
dbWhy do they call it rush hour when nothing moves? - Robin Williams
-
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:
And post this code: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:
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); } }}}
- 12-05-2012, 06:26 PM #5


LinkBack URL
About LinkBacks


Bookmarks