I am very tired of using the encoding for the mp3 file and show number for the item, but item shows the numbers of all the files and folders for the item. this code
File[]dirs = f.listFiles();
this.setTitle(""+f.getName());
List<Item>dir = new ArrayList<Item>();
List<Item>fls = new ArrayList<Item>();
try{
for(File ff: dirs)
{
Date lastModDate = new Date(ff.lastModified());
DateFormat formater = DateFormat.getDateTimeInstance();
String date_modify = formater.format(lastModDate);
if(ff.isDirectory()) {
File[] fbuf = ff.listFiles();
int buf = 0;
if (fbuf != null) {
buf = fbuf.length;
} else buf = 0;
String num_item = String.valueOf(buf);
if (buf == 0) num_item = num_item + " item";
else num_item = num_item + " items";
dir.add(new
Item(ff.getName(), num_item, null, ff.getAbsolutePath(), "directory_icon"));
}
`
source
share