Hi,
I made 3 Lists A,B,C. I used CommandListener on all these 3Lists. so When i click on A it should show another 3 Lists X,Y,Z. And when i click on X,it should show me an text and image.
When you click on X,i tried it using ItemStateListener.
But when i click on X it is shows nothing.
I am attaching one image file so that you can understand my problem.
Please give me solution.
Thanks and regards
Sharvari.



import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.Ticker;
import java.io.*;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.ImageItem;

public class newAsans1 extends MIDlet implements CommandListener
{
Ticker tick;
private List mList,medList;
private Command cmdExit;
private Command cmdBack;
private ImageItem imageItem;

public newAsans1()
{
tick=new Ticker("Health is Wealth");

String[] stringElements={"A","B","C"};

Image[] imageElements={loadImage("/flower.png"),loadImage("/flower.png"),loadImage("/flower.png")};

mList=new List("Asans Types",List.IMPLICIT,stringElements,imageElements);

cmdExit=new Command("Exit",Command.EXIT,1);
cmdBack=new Command("Back",Command.SCREEN,1);

mList.addCommand(cmdExit);

mList.setCommandListener(this);

mList.setTicker(tick);
}

protected void startApp() throws MIDletStateChangeException
{
Display disp=Display.getDisplay(this);
disp.setCurrent(mList);
}

protected void pauseApp()
{
}

protected void destroyApp(boolean arg0)throws MIDletStateChangeException
{
}

public void commandAction(Command arg0,Displayable d)
{
if(arg0==cmdExit)
{
try
{
destroyApp(false);
notifyDestroyed();
}
catch(Exception e)
{
System.out.println(e);
}
}

else

if(arg0==cmdBack)
{
try
{
Display.getDisplay(this).setCurrent(mList);
}
catch(Exception e)
{
System.out.println(e);
}
}


else

if(arg0==List.SELECT_COMMAND)
{



try
{

int index=mList.getSelectedIndex();

if(index==0)
{

String[] stringElementsMed={"X","Y","Z"};

Image[] imageElementsMed={loadImage("/flower.png"),loadImage("/flower.png"),loadImage("/flower.png")};

medList=new List("Asans Types",List.IMPLICIT,stringElementsMed,imageElementsMed);
medList.setCommandListener(this);
medList.addCommand(cmdBack);
Display.getDisplay(this).setCurrent(medList);
public void commandAction(Command c,Displayable db)
{
if(c==List.SELECT_COMMAND)
{
try
{
int ind=medList.getSelectedIndex();
if(ind==0)
{
Form frm=new Form("");
String path="/flower.png";
Image img=Image.createImage(path);
imageItem=new ImageItem("Meditation series",img,ImageItem.LAYOUT_LEFT,"image not found");
frm.append(imageItem);
Display.getDisplay(this).setCurrent(frm);
frm.addCommand(cmdBack);
frm.setCommandListener(this);
}
}
catch(Execption e)
{
System.out.println(e);
}
}
}


//------------------------
//tick=new Ticker("Meditation Series");
//Form frm=new Form("");
//frm.setTicker(tick);
//String path="/flower.png";
//Image img=Image.createImage(path);
//imageItem=new ImageItem("Meditation series",img,ImageItem.LAYOUT_LEFT,"image not found");
//frm.append(imageItem);
//Display.getDisplay(this).setCurrent(frm);
//frm.addCommand(cmdBack);
//frm.setCommandListener(this);
//-------------------------------

//Image image1=Image.createImage("/flower.png");
//NO... public static Image createImage("/flower.png",10,20,96,96,0);
//NO... append(new ImageItem(null,image1,ImageItem.LAYOUT_LEFT,null));
//Alert a=new Alert("Your Selection","Halasan is good for mind" +mList.getString(index) +".",image1,AlertType.INFO);
//a.setTimeout(Alert.FOREVER);
//Display.getDisplay(this).setCurrent(a,mList);
}




if(index==1)
{

tick=new Ticker("Relaxation Series");
Form frm=new Form("");
frm.setTicker(tick);
String path="/flower.png";
Image img=Image.createImage(path);
imageItem=new ImageItem("Relaxation series",img,ImageItem.LAYOUT_LEFT,"image not found");
frm.append(imageItem);
Display.getDisplay(this).setCurrent(frm);
frm.addCommand(cmdBack);
frm.setCommandListener(this);

}


if(index==2)
{
tick=new Ticker("Vajrasan Series");
Form frm=new Form("");
frm.setTicker(tick);
String path="/flower.png";
Image img=Image.createImage(path);
imageItem=new ImageItem("Vajrasan series",img,ImageItem.LAYOUT_LEFT,"image not found");
frm.append(imageItem);
Display.getDisplay(this).setCurrent(frm);
frm.addCommand(cmdBack);
frm.setCommandListener(this);
}



}



catch(Exception e)
{
System.out.println(e);
}
}
}

private Image loadImage(String name)
{
Image image=null;
try
{
image=Image.createImage(name);
}
catch(IOException e)
{
System.out.println("HELLO");
}
return image;
}
}