im trying to get a file list at the directory "/storage/emulated/0/tmp/subtmp/"
then sort it in newest first order./get sorted list stating itself.
^ this is the order I'm trying to achieve.
fourth
third
first
last
second
I tried using
lastModified()but it errors, looks like, there is noFiledata type...
so i tried to fetch
view-source:file:///storage/emulated/0/tmp/subtmp/,which contains modified date & time.
but
that didn't happened..
then i tried using [ls command],
try {
Runtime.getRuntime().exec("ls -t /storage/emulated/0/tmp/subtmp/");
edittext.setText("done");
} catch (Exception e ) {
edittext.setText("not done");
ans.setText(e.toString());
}
and
try {
Runtime.getRuntime().exec("ls -t /storage/emulated/0/tmp/subtmp/ > /storage/emulated/0/tmp/output.txt"); //to read and delete
edittext.setText("done");
} catch (Exception e ) {
edittext.setText("not done");
ans.setText(e.toString());
}
but,.. no new files are created on
/storage/emulated/0/tmp/
so, is it possible to sort files in sketchware
- it doesnt have any block to get sorted list
- it does have a add source directly block



I face same issue in show last edited image in first of all [SORT BY TIME], I found solution for me and this code will be help into sort arraylist by time.