I have a dirPath
String variable that I want to be able to change to a directory of my choice for an Android TV app. I find the Leanback framework's slideshow-like interface a little cumbersome for subtler actions but I would like to stick to it when I can as I'm a complete beginner on Android and java in general.
So, trying to stick to best practices, I would like the user to be able to change dirPath
to point to a directory of their choosing (dirPath
is used as a variable to scan for music in the nominated directory and its subdirectories). On other platforms I would look for a standard file open dialog for the OS, but I can't seem to find one in the Leanback framework.
My best guess is using GuidedStepFragments. This feels a little inelegant to bring in an entire options page (see my earlier comment about leanback's slideshow-like UX) all for the sake of choosing a directory, but it looks like I have little choice? Secondly, I don't see any file dialog widget amongst the GuidedActions. Perhaps I've missed it, or else Google was keen to direct file choosing to online and not local.
Additional Information:
I'm attempting to scan for mp3 and flac files in all subdirectories of dirPath
and then adding the paths, metadata etc. into an SQLite
database that I already have working with dummy data. I'm avoiding mediastore
as it has too many limitations, particularly its inability to access network shares, which would be desirable for me for NAS access.
Once the user has nominated a dirPath
and a scan is started, I'll pass this to AsyncTask
to run on a separate background thread from the UI.
To Summarise:
I'm attempting to scan the attached storage of an Android TV device for music files using AsyncTask
in a different thread than the UI. The scan will be fed the dirPath
String variable and will examine this path and all of its subdirectories for music files, which it will then pass onto a metadata extractor, before storing the relevant data in an SQLite
database.
I think I have some understanding of implementing the scan (Google provides examples) and have successfully implemented inserting dummy data into a database. What I can't seem to manage is to provide a simple means of letting the user select the path(s) to scan using Android TV's Leanback library. Apparently this isn't available in Leanback. Is there a way I can implement this that isn't a nightmare? I'm looking for as simple a directory choosing dialog box as possible. If it has to use an entire option page, ala GuidedStepFragments
, so be it.