title: Implementing a File Dialog in Android TV Leanback
body: <p>I have a <code>dirPath</code> <em>String</em> 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.</p>
  
  <p>So, trying to stick to best practices, I would like the user to be able to change <code>dirPath</code> to point to a directory of their choosing (<code>dirPath</code> 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.</p>
  
  <p>My best guess is using <a href="http://peirr.com/working-with-guidedstepfragments-on-android-tv/" rel="nofollow">GuidedStepFragments</a>. 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 <a href="https://developer.android.com/reference/android/support/v17/leanback/widget/GuidedAction.html" rel="nofollow">GuidedActions</a>. Perhaps I've missed it, or else Google was keen to direct file choosing to online and not local.</p>
  
  <hr>
  
  <p><strong>Additional Information:</strong></p>
  
  <p>I'm attempting to scan for <em>mp3</em> and <em>flac</em> files in all subdirectories of <code>dirPath</code> and then adding the paths, metadata etc. into an <code>SQLite</code> database that I already have working with dummy data. I'm avoiding <code>mediastore</code> as it has too many limitations, particularly its inability to access network shares, which would be desirable for me for NAS access.</p>
  
  <p>Once the user has nominated a <code>dirPath</code> and a <em>scan</em> is started, I'll pass this to <code>AsyncTask</code> to run on a separate background thread from the UI.</p>
  
  <hr>
  
  <p><strong>To Summarise:</strong></p>
  
  <p>I'm attempting to scan the attached storage of an Android TV device for music files using <code>AsyncTask</code> in a different thread than the UI. The scan will be fed the <code>dirPath</code> <em>String</em> 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 <code>SQLite</code> database.</p>
  
  <p>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 <em>Leanback</em> library. Apparently this isn't available in <em>Leanback</em>. 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 <code>GuidedStepFragments</code>, so be it.</p>