Note that there are some explanatory texts on larger screens.

plurals
  1. POFragments and intent filters
    primarykey
    data
    text
    <p>We all know how we can use intent-filters in our AndroidManifest.xml to declare capabilities of activities such as search, push, and so on. I currently use such an intent-filter to register a custom URL scheme in the following manner:</p> <pre><code>&lt;activity android:name="NameOfActivity" &gt; &lt;intent-filter &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.BROWABLE" /&gt; &lt;data android:host="" android:scheme="customscheme" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>This all worked very well until I decided to transform all my activities into fragments, as I needed to display the user interface in a different manner on tables. Now, on devices that are declared as <em>large</em> or greater, instead of switching between activities I have one activity that removes and adds new fragments as requested. This choice was taken as the left-hand side of the screen allways displays the same content, so instead of adding this content ito all activities I instead change the fragments.</p> <p>The problem here is that while the intent-filter launches the correct activity on the phone, this activity should never be launched on a tablet. Instead, I would like to handle this URL in the fragment. As of now, I see no way of fixing this. One thought was to add the intent-filter programmatically, but after some research i cannot figure out if this is possible or not. Another thought was to somehow add the intent-filter on the fragment, but this would not work as a fragment cannot launch without an activity hosting it.</p> <p><strong>In short</strong>: On a phone, I need one activity to handle the intent-filter, but on a tablet I need another activity to handle the intent-filter.</p> <p>Is there any way of accomplishing this?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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