Skip to content

Instantly share code, notes, and snippets.

@minas1
minas1 / gist:f920c037e511f71a1d06c9261f3307be
Created November 9, 2018 16:26
Exclude your own Activity from Activity.startActivity(Intent) chooser
/**
* Attempts to start an activity to handle the given intent, excluding activities of this app.
* <ul>
* <li>If the user has set a default activity (which does not belong in this app's package), it is opened without prompt.</li>
* <li>Otherwise, an intent chooser is displayed that excludes activities of this app's package.</li>
* </ul>
*
* @param context context
* @param intent intent to open
* @param chooserTitle the title that will be displayed for the intent chooser in case one needs to be displayed.