Selecting a specific type of file in android
<p>I am trying to make an app where the user can select a file using the android device's file manager. Here is the code that I am using :</p>

<pre><code> boolean isKitKat = Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT;
                    if (isKitKat)
                    {
                        Intent uploadIntent = new Intent();
                        uploadIntent.setType("*/*");
                        uploadIntent.setAction(Intent.ACTION_GET_CONTENT);
                        startActivityForResult(uploadIntent, REPORT_USING_FILE_MANAGER);

                    }
                    else
                    {
                        Intent uploadIntent = new Intent(Intent.ACTION_GET_CONTENT);
                        uploadIntent.setType("*/*");
                        startActivityForResult(uploadIntent, REPORT_USING_FILE_MANAGER);
                    }
</code></pre>

<p>I only want the user to be able to select an image file (.jpg, .png etc) or a .pdf file. How can I set this restriction ?</p>