Simple File Manager?

238 views
Skip to first unread message

Elmer Martens

unread,
Oct 2, 2015, 4:36:54 PM10/2/15
to AndroidScript
How to make a simple File Manager?
Please!

Thanks

Steve Garman

unread,
Oct 2, 2015, 5:00:25 PM10/2/15
to AndroidScript
Pretty much you make anything.

Decide what you want it to do, think roughly what you want it to look like and then decide how you are going to do it.

I have never coded a file manager in DroidScript but I did at one time use a file-explorer I coded myself.

There is a blog-post I wrote less than a month after I had discovered DroidScript ( that was not its name then ) so remember, this was written by a beginner with what is now a very old version of DroidScript.

I have no idea whether the code will still run or what it looks like if it does. I expect the app design is embarrassing.

But it may help you think about what you want.

http://androidscriptkiddy.blogspot.co.uk/2014/08/coding-file-explorer.html

Message has been deleted
Message has been deleted

Elmer Martens

unread,
Oct 12, 2015, 4:44:14 PM10/12/15
to AndroidScript
Hi,
Is there an example that shows how a list can hide the files and just show the folders?

Steve Garman

unread,
Oct 12, 2015, 4:51:09 PM10/12/15
to AndroidScript
You loop through the list testing each file with app.IsFolder() to decide whether to add it to your final list.

This sample may help.
http://wiki.droidscript.me.uk/doku.php?id=sample_code:folder_picker

Elmer Martens

unread,
Oct 12, 2015, 5:13:19 PM10/12/15
to AndroidScript
Thanks for that.
If I can ask for a little more help with this thing, can you show my isn't right on this code below or why doesn't work right?

var folder = "/sdcard/DroidScript";

//Called when application is started. 
function OnStart() 
{

//Create a layout with objects vertically centered. 
lay = app.CreateLayout( "linear", "FillXY" );  

lst = app.CreateList(  "", 1, 1); 
Items = app.ListFolder(folder).toString().split(","); 
for ( i=0; i<Items.length; i++) 

if( app.IsFolder( folder + Items[i] )) 

lst.AddItem( Items[i], "Folder", "Folder"); 

else 

lst.AddItem( Items[i], "File", "photofolder");
}
}
lay.AddChild( lst );

app.AddLayout( lay ); 
}






Steve Garman

unread,
Oct 12, 2015, 5:22:51 PM10/12/15
to AndroidScript
It is difficult to answer that question as you did not explain what you expected to happen and what happened that was different.

However, at a quick glance, I would guess you are missing a slash.

if( app.IsFolder( folder + "/" + Items[i] )) 

Elmer Martens

unread,
Oct 12, 2015, 5:32:47 PM10/12/15
to AndroidScript
Yeah that really was my problem,
I should by more careful.

Thanks for your help.

Reply all
Reply to author
Forward
0 new messages