×

Discussion Board

Results 1 to 2 of 2

Hybrid View

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    11

    problem in file enumeration

    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();
    	}
    }
    Last edited by sandeepintg; 2012-11-01 at 09:54.

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2010
    Location
    Singapore
    Posts
    221

    Re: problem in file enumeration

    i used this same code before for accessing my image directory using here maybe it can help yours by

Similar Threads

  1. Enumeration & Deteling records in an RMS
    By WildHeart in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2010-04-28, 23:54
  2. enumeration of verious possible sizes?
    By jupitar in forum Symbian
    Replies: 2
    Last Post: 2009-10-28, 11:44
  3. NoSuchElementException in 7610,but no Enumeration in the program
    By oldduck76 in forum Mobile Java General
    Replies: 3
    Last Post: 2007-10-31, 19:29
  4. file enumeration
    By nicholasgaye in forum Symbian
    Replies: 0
    Last Post: 2005-04-25, 15:08
  5. Problem passing enumeration to constructor
    By advocatee in forum Symbian
    Replies: 3
    Last Post: 2003-11-27, 06:59

Posting Permissions

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