Efficient implementation of File Explorer - Android -
i'm creating simple file explorer on android studio, , wonder 1 of following implementations best:
my solution: have activity called mainactivity displays list of files, , each time user clicks on directory, creates new mainactivity (and oncreate method gets new list of files, ...).
correction: in correction tutorial, found when user clicks on directory, instead of starting new activity, code keeps current 1 , changes (clear list , fill new files, change title...).
is there solution better other ? more efficient keep same activity ?
thanks help.
keep single activity no question !
when user clicks item build data-source based on newly selected path. make sure distinct between files , directories. call notifydatasetchanged , thats !
to query file system there 2 ways:
- the easy - use java file.listfiles()
- the hard - run shell command runtime.getruntime().exec( "ls -la" ) , parse response.
there many open source projects on github subject. example:
Comments
Post a Comment