java - How to display name of the files without extensions and in alphabetical order -


i have script allow display inside list view, name of files located in specific folder.

i know if possible adapt script display files without extension , in alphabetical order. thank you

    file dir = new file(environment.getexternalstoragedirectory().getpath() + "/osmdroid/tiles/");     file[] filelist = dir.listfiles();     string[] thenamesoffiles = new string[filelist.length];     (int = 0; < thenamesoffiles.length; i++) {        thenamesoffiles[i] = filelist[i].getname();     }      adapter = new arrayadapter<string>(this, r.layout.list_row, thenamesoffiles);     lv.setadapter(adapter); 

try this

file dir = new file(environment.getexternalstoragedirectory().getpath() + "/osmdroid/tiles/"); file[] filelist = dir.listfiles(); string[] thenamesoffiles = new string[filelist.length]; (int = 0; < thenamesoffiles.length; i++) {    //do little change    string temp = filelist[i].getname();    thenamesoffiles[i] = temp.substring(0,temp.length() - temp.lastindexof(".")); } arrays.sort(thenamesoffiles) adapter = new arrayadapter<string>(this, r.layout.list_row, thenamesoffiles); lv.setadapter(adapter); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -