Android: how to get a directory list ordered by name or by date descending?

后端 未结 9 695
轮回少年
轮回少年 2020-12-30 09:48

I\'m able to do this:

    File images = new File(path);  
    File[] imageList = images.listFiles(new FilenameFilter(){  
        public boolean accept(File          


        
9条回答
  •  天涯浪人
    2020-12-30 10:36

    The right way to order files by date of last modified in reverse mode is doing:

    Arrays.sort(Files, LastModifiedFileComparator.LASTMODIFIED_REVERSE); 
    

    for this instruction you will need the commons.io library from org.apache that you can download from here

提交回复
热议问题