Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For the first problem (chooser issue), the reason you are getting the error "no application can perform this action" is because the <code>Intent</code> you are passing to <code>getChooser()</code> doesn't have an ACTION in it that Android can use to search for applications that can handle the <code>Intent</code>. <code>getChooser</code> will use the ACTION, CATEGORY and DATA in the <code>Intent</code> to search for suitable applications. It will then use package and component names to filter this list. In your case, because you've only provided the package and component names (but haven't specified ACTION), Android can't find any suitable applications. I'm not sure there's a way around this, since you want to build a list with different packages. You may just need to create your own chooser dialog (which is probably the correct thing to do here anyway, as you don't really get any advantages using the Android chooser because you've already decided what the list should contain).</p> <hr> <p>For the second problem (if application is in background, it gets restarted) you need to use the following flags:</p> <pre><code>targetedIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); </code></pre> <p>Specifying <code>Intent.FLAG_ACTIVITY_NEW_TASK</code> when launching the root activity of a task will bring an already existing task to the foreground.</p> <p>NOTE: If you want to just bring the existing task to the foreground (in whatever state it happens to be), then just use <code>Intent.FLAG_ACTIVITY_NEW_TASK</code> and remove the other 2 flags.</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.
    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.
 

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