Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The bad news: there is no built-in (SDK level) preview component/View for you to use. </p> <p>The good news: Android supports Intents that allow you to leverage other apps to do the work for you and return a selected file with a requested file type. </p> <p>There are a few things that you can do depends on your targets: </p> <ol> <li><p>API 19+: On device with API 19, you should use the Storage Access Framework (<a href="https://developer.android.com/guide/topics/providers/document-provider.html">https://developer.android.com/guide/topics/providers/document-provider.html</a>) All the previews etc will be done on the responding app. </p> <p>You will be looking at using Intent.ACTION_OPEN_DOCUMENT. </p></li> <li><p>For older devices: There is an intent that you can use with optional file type and category you can use. This will open either a built-in file selector OR a third party app.</p> <pre><code>Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(intent, REQUEST_CODE); </code></pre> <p>**Note you could create a Intent chooser here.</p></li> <li><p>For devices that do not have any app that can respond to the Intent: You can either bundle something prebuilt (<a href="https://code.google.com/p/android-file-dialog/">https://code.google.com/p/android-file-dialog/</a>) or depending on the file type, you can query the content database for media files and display them yourself with a nice UI. </p></li> </ol> <p>Additional Reference on how to use Intents and how it works: <a href="http://developer.android.com/guide/components/intents-filters.html">http://developer.android.com/guide/components/intents-filters.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload