Checking existence of an Activity
<p>I am considering the code in <a href="https://stackoverflow.com/questions/2878694/determining-if-an-activity-exists-on-the-current-device/2879403#2879403">this question</a>, and did the following:</p>

<p>First, I create a simple, empty project with only one <code>Activity</code> called <code>MainActivity</code>, which is in package <code>com.example.plugins</code>. I compile this project and install it to my device. The app works fine.</p>

<p>Then, in another project I have this code:</p>

<pre><code>Intent plugins = new Intent();
plugins.setClassName("com.example.plugins", "MainActivity");
List&lt;ResolveInfo&gt; list = getPackageManager().queryIntentActivities(plugins,
                PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() &gt; 0) {
    tvText.setText("Plugins.");
} else {
    tvText.setText("No Plugins.");
}
</code></pre>

<p>I'd say this should work, but it doesn't. It gives "no plugins". Am I missing something here?</p>

<p><strong>Update</strong> When using</p>

<pre><code>PackageInfo pi = getPackageManager().getPackageInfo(
                    "com.example.plugins", PackageManager.GET_ACTIVITIES);
</code></pre>

<p>I do get the activities from that other app.</p>