java - What are fields i should change for my codes to suit my own codes? -


what fields in example (below) should change in relation mainactivity.java file? sorry i'm kinda new in android/java therefore don't know fields change suit existing code. can help?

my mainactivity.java file

file dirlist = new file(environment.getexternalstoragedirectory() + "/videolist");  if(!(dirlist.exists()))     dirlist.mkdir();      file tempfile = new file(environment.getexternalstoragedirectory() + "/videolist", dateformat.format(date) + fileformat); 

this example found not know fields should change here suit code above. want preserve existing function of calculating size of directory.

private static long dirsize(file dir) {     long result = 0;      stack<file> dirlist= new stack<file>();     dirlist.clear();      dirlist.push(dir);      while(!dirlist.isempty())     {         file dircurrent = dirlist.pop();          file[] filelist = dircurrent.listfiles();         (int = 0; < filelist.length; i++) {              if(filelist[i].isdirectory())                 dirlist.push(filelist[i]);             else                 result += filelist[i].length();         }     }      return result; } 

i don't want, if want size of directory is:

file dir = new file("c:/dir");  if (!dir.isdirectory()) {     dir.mkdirs(); } long dirlength = dir.length(); system.out.println(dirlength); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -