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:

  1. the easy - use java file.listfiles()
  2. the hard - run shell command runtime.getruntime().exec( "ls -la" ) , parse response.

there many open source projects on github subject. example:

amaze file manager


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -