title: Intent Filter of File Extension for specific activity
body: <p>I have 2 custom file extensions <code>*.abc</code> and <code>*.xyz</code>.</p>
  
  <p>I have written <strong>Intent filters</strong> for activities where file having <code>*.abc</code> extension should be opened in <code>Activity1</code> and <code>*.xyz</code> should be open in <code>Activity2</code></p>
  
  <p>Those files having <strong>serialized java objects</strong> and not plain text files.</p>
  
  <p>These are intent filters for those activities in <strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;activity
      android:name=".ui.Activity1"&gt;
      &lt;intent-filter tools:ignore="AppLinkUrlError"&gt;
          &lt;action android:name="android.intent.action.VIEW" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  
          &lt;data android:mimeType="*/*" /&gt;
          &lt;data android:pathPattern=".*\\.abc" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  &lt;activity
      android:name=".ui.Activity2"&gt;
      &lt;intent-filter tools:ignore="AppLinkUrlError"&gt;
          &lt;action android:name="android.intent.action.VIEW" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  
          &lt;data android:mimeType="*/*" /&gt;
          &lt;data android:pathPattern=".*\\.xyz" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>I am able to register those extension in android system and my app activities are showing in app chooser of Android System UI</p>
  
  <p>I am printing URI info in logcat as follows</p>
  
  <pre><code>Timber.i(uri.toString())
  val mimeType = contentResolver.getType(uri)
  Timber.i(mimeType)
  </code></pre>
  
  <p>Logcat when file opened from <strong>WhatsApp</strong></p>
  
  <pre><code>content://com.whatsapp.provider.media/item/5237
  application/octet-stream
  </code></pre>
  
  <p>Logcat when file opened from <strong>Solid Explorer</strong></p>
  
  <pre><code>content://pl.solidexplorer2.files/storage/emulated/0/Download/File1.abc
  application/*
  </code></pre>
  
  <p>But when tap either of file (custom extension) it shows both Activities as openable Intent,
  for eg. If click on file file1.abc it <strong>shows both Intent Filters</strong> of extensions as <strong>Activity1 and Activity2</strong> </p>
  
  <p>I want to make those <strong>extensions Activity Specific</strong>
  like if click on file with extension *.abc it should only have Activity1 in Intent Chooser of Android System UI</p>
  
  <p>I have tried few methods explained in other answers but those <strong>doesn't</strong> seems to work properly for both file format with <strong>content type URI</strong></p>
  
  <p>Some solutions only working when file opened from File Browsers like <strong>Solid Explorer</strong> but doesn't work when open from apps like WhatsApp which uses <strong>MIME</strong> type as media</p>
  
  <p>Intent filter below properly worked with <strong>Solid Explorer</strong>.
  It is filtering activity based on custom file extension. But same Intent Filter won't work for Android System's Chooser dialog as it doesn't work in apps like <strong>WhatsApp</strong> or <strong>Gmail</strong> which uses Android System's Intent Chooser</p>
  
  <pre><code>&lt;activity
      android:name=".ui.Activity1"&gt;
      &lt;intent-filter&gt;
          &lt;data
              android:host="*"
              android:mimeType="*/*"
              android:pathPattern=".*\\.abc"
              android:scheme="content" /&gt;
  
          &lt;action android:name="android.intent.action.VIEW" /&gt;
  
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  &lt;activity
      android:name=".ui.Activity2"&gt;
      &lt;intent-filter&gt;
          &lt;data
              android:host="*"
              android:mimeType="*/*"
              android:pathPattern=".*\\.xyz"
              android:scheme="content" /&gt;
  
          &lt;action android:name="android.intent.action.VIEW" /&gt;
  
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>Any help will be appreciated.
  Thanks.</p>