title: How to get more control over Android SAF UI (e.g ACTION_OPEN_DOCUMENT)?
body: <p>I would like the SAF to “launch the navigator in the specified document if it's a folder” (as they call it in the docs).</p>
  
  <p>This does not work so i also wonder if i can add storage shortcuts to the SAF UI. See the picture at this link: <a href="https://i.imgur.com/yGtcGMM.jpg" rel="noreferrer"><a href="https://i.imgur.com/yGtcGMM.jpg" rel="noreferrer">https://i.imgur.com/yGtcGMM.jpg</a></a></p>
  
  <p>But i think it is more possible to launch the SAF UI in a specific folder so i might go for that approach for the moment. I have tried this in the <code>onCreate(...)</code>-method: </p>
  
  <pre><code>String pathAsString = Environment.getExternalStorageDirectory() + "/myscientificapp/measurements/";
  File pathAsFile = new File(pathAsString);
  
  if (pathAsFile.exists()) { Log.d(TAG, "pathAsFile exists!"); } //This is printed in Logcat
  
  android.net.Uri pathAsUri = Uri.fromFile(pathAsFile);
  Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
  intent.addCategory(Intent.CATEGORY_OPENABLE);
  intent.setType("*/*");
  intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pathAsUri); //Does not make effect
  startActivityForResult(intent, REQUEST_OPEN_DOCUMENT);
  </code></pre>
  
  <p>The thing is that it don't work.. or i do not know how to do it. :/</p>
  
  <p>I have read a bit on these places. For example at <a href="https://medium.com/@ianhlake/hidden-gems-of-android-o-7def63136629" rel="noreferrer">Medium.com</a> a developer says:</p>
  
  <blockquote>
    <p>When selecting a location to save a file using ACTION_CREATE_DOCUMENT or when opening a document, the new EXTRA_INITIAL_URI allows you to override the default initial location (the last location the user selected) with your own custom starting location.</p>
  </blockquote>
  
  <p>And on the Android docs we can read about this <a href="https://developer.android.com/reference/kotlin/android/content/Intent#action_open_document%0A" rel="noreferrer">EXTRA_INITIAL_URI</a>:</p>
  
  <blockquote>
    <p>Callers can set a document URI through DocumentsContract#EXTRA_INITIAL_URI to indicate the initial location of documents navigator. System will do its best to launch the navigator in the specified document if it's a folder, or the folder that contains the specified document if not.</p>
  </blockquote>
  
  <p>We can also read about it at <a href="https://developer.android.com/reference/android/provider/DocumentsContract#EXTRA_INITIAL_URI" rel="noreferrer">DocumentsContract#EXTRA_INITIAL_URI</a>:</p>
  
  <blockquote>
    <p>EXTRA_INITIAL_URI<br/><br/>
    ...<br/>
    Sets the desired initial location visible to user when file chooser is shown.<br/>...<br/>Location should specify a document URI or a tree URI with document ID. If this URI identifies a non-directory, document navigator will attempt to use the parent of the document as the initial location.<br/><br/>The initial location is system specific if this extra is missing or document navigator failed to locate the desired initial location.</p>
  </blockquote>
  
  <p>High abstraction languages in all its glory, but i would like to at least get some details of how to use this feature.</p>
  
  <p>But here on Stackoverflow some developers tells us that <a href="https://stackoverflow.com/questions/52057001/open-specific-path-using-storage-access-framework">it will not work</a>.</p>
  
  <p>And some <a href="https://stackoverflow.com/questions/30115263/open-specific-directory-using-storage-access-framework">threads are not really answered yet</a>.</p>
  
  <p>So according to some sources it should work. </p>
  
  <p>Someone who know how to create shortcuts in the SAF UI (see the picture)? Or how to make the SAF “launch the navigator in the specified document if it's a folder” with for example ACTION_CREATE_DOCUMENT? (If i remember right, these features existed in Windows 95 for example :>   )</p>
  
  <p>EDIT:
  I removed some links to the git-project because of eventual "link-rot" as @A Jar of Clay hinted about.</p>
  
  <p>I did also try to pass a tree Uri (as @CommonsWare recommended) from ACTION_OPEN_DOCUMENT_TREE onto the method <code>intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pathAsTreeUri);</code> . But SAF did not start in the location i passed as Uri. :(</p>