my code goes through some recursion, but is not proper.It does not show all the files in phone. I guess the problem may be in setting stack size. then how to set the stack size?my code is
Code:public class dirMidlet extends MIDlet { private static final String UP_DIRECTORY = ".."; private static final String MEGA_ROOT = "/"; private static final String SEP_STR = "/"; private static final char SEP = '/'; private String currDirName; List browser= new List(currDirName, List.IMPLICIT); public dirMidlet() { // TODO Auto-generated constructor stub currDirName = MEGA_ROOT; } protected void startApp() throws MIDletStateChangeException { Enumeration e; Vector v; FileConnection currDir = null; e = FileSystemRegistry.listRoots(); //List browser; show(e,SEP_STR); Display disp=Display.getDisplay(this); disp.setCurrent(browser); } public void show(Enumeration e,String afileName) { try { while (e.hasMoreElements()) { FileConnection currDir = null; String fileName = (String) e.nextElement(); System.out.println("inside while..."+fileName); browser.append(fileName,null); if (fileName.charAt(fileName.length() - 1) == SEP) { System.out.println("folderName"+afileName+fileName); currDir = (FileConnection)Connector.open("file://localhost" +afileName+ fileName); //Enumeration en; show(currDir.list(),afileName+fileName); } else System.out.println("inside else file name..."+fileName); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }

Reply With Quote

