I'm implementing a file manager in which i'm opening a folder on a listView which contains another folders and so on .... I'm wondering how could I implement opening these consecutive folders, do I have to write a series of activities which would be up to 10
Asked
Active
Viewed 54 times
-1
-
5refer [Android Programming: Where To Start For Creating A Simple File Browser?](http://stackoverflow.com/questions/4108881/android-programming-where-to-start-for-creating-a-simple-file-browser) – Ravi Dec 26 '16 at 05:18
-
1you have to use fragment instead of activity. – vishal patel Dec 26 '16 at 05:20
-
thanks @RaviRupareliya , I've done most of the work in the file Browser I just still have two points to finish ..this is one of them – SaTech Dec 26 '16 at 05:21
-
@vishalpatel thanks vishal... but with fragments will I have to write many of fragments .....one for each folder? – SaTech Dec 26 '16 at 05:23
-
1no.. you have to manage your Adapter class .. for directory file and file type – vishal patel Dec 26 '16 at 05:29
-
@vishalpatel would you provide me more details – SaTech Dec 26 '16 at 05:31
1 Answers
2
To clarify: you are asking how you can implement a directory navigation GUI that expands a directory into a list when selected. And you are confused that if you navigate into multiple levels of nested directly you will need to write that that activities, one for each level.
Obviously you do not have to write one activity for each directory level you navigate into.
- You can use just one ListView inside one Activity, but repopulate the content of the ListView every time user opens a directory
- If you want a your ListView of directory content inside a sliding panel, take a look at ViewPager.

flintlock
- 97
- 7
-
I used one activity and i populated the new floder content each time the user clicks on a folder item on the list ...... but how to return back to the previous list – SaTech Dec 26 '16 at 11:57
-
I see, your are confused about how to keep a path of bread crumb. You have to realize that you can keep a data structure internally to keep track of the current path. Such as using a stack. When you go up one level, pop the stack; when you open a directory, push that directory onto the stack. – flintlock Dec 26 '16 at 12:09
-
Even better, don't use a stack but use Java [Path](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html), it has everything you need to keep track of current path. – flintlock Dec 26 '16 at 12:25
-
-
-
i mean returning from the current listView to the previous one within the same activity – SaTech Dec 26 '16 at 13:11
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/131512/discussion-between-satech-and-flintlock). – SaTech Dec 26 '16 at 13:13