title: Pick a .bin file via Intent.createChooser in Android
body: <p>Running this code allows a user to select a file:</p>
  <pre><code>private int PICKFILE_RESULT_CODE = 3456;
  Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);
  chooseFile.addCategory(Intent.CATEGORY_OPENABLE);
  chooseFile.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
  chooseFile.setType(&quot;file/*&quot;);
  chooseFile = Intent.createChooser(chooseFile, &quot;Choose a file&quot;);
  startActivityForResult(chooseFile, PICKFILE_RESULT_CODE);
  </code></pre>
  <p>How can I adapt this code to ensure <em>only .bin files</em> can be selected?</p>
  <p>I have currently two problems:</p>
  <ul>
  <li>.bin files are shown as <em>folders</em>, (empty folders)</li>
  <li>I don't know how to restrict the file picker to only files with a specific extension.</li>
  </ul>
  <hr />
  <p><strong>[update]</strong>
  Weirdly enough, when trying this code on another Android 10 phone, no file can be selected.</p>
  <p>When adapting the code snippet to:</p>
  <pre><code>private int PICKFILE_RESULT_CODE = 3456;
  Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);
  chooseFile.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
  chooseFile.setType(&quot;*/*&quot;);
  chooseFile = Intent.createChooser(chooseFile, &quot;Choose a file&quot;);
  startActivityForResult(chooseFile, PICKFILE_RESULT_CODE);
  </code></pre>
  <p>the selection of a file with extension .bin <em>is</em> possible, but only on that second phone. On the first phone, binary files are still presented as empty folders.</p>
  <hr />
  <p><strong>[update]</strong></p>
  <p>To augment the confusion, removing the call to <code>createChooser</code> seems to have no effect, on both my phones. Or the other way around, adding the call seems to have no effect.</p>
  <pre><code>private int PICKFILE_RESULT_CODE = 3456;
  Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);
  chooseFile.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
  chooseFile.setType(&quot;*/*&quot;);
  startActivityForResult(chooseFile, PICKFILE_RESULT_CODE);
  </code></pre>
  <p>Which makes me wonder, what that call is supposed to be doing?</p>
  <p>Can somebody make sense of this?</p>