title: Cannot start new Intent by setClassName with different package in Android
body: <p>I want to start a new Intent dynamically. Therefore <code>setClassName</code> seems the best choice.</p>
  
  <p>First, I define 3 activity in Manifest</p>
  
  <pre><code>&lt;activity android:name="com.example.pkg2.Act" /&gt;
  &lt;activity android:name="com.example.pkg1.Act1" /&gt;
  &lt;activity android:name="com.example.pkg1.Act2" /&gt;
  </code></pre>
  
  <p>From <code>com.example.pkg2.Act</code>:</p>
  
  <pre><code>Intent intent = new Intent();
  if(index == 0) intent.setClassName(Act.this, "com.example.pkg1.Act1");
  else intent.setClassName(Act.this, "com.example.pkg1.Act2");
  startActivity(intent);
  </code></pre>
  
  <p>And will get this exception:</p>
  
  <pre><code>Unable to find explicit activity class {com.example.pkg2.Act/com.example.pkg1.Act1}; have you declared this activity in your AndroidManifest.xml?
  </code></pre>
  
  <p>It looks like we can only use <code>setClassName</code> to dynamically start new Activity but within the same package.</p>
  
  <p>Any idea to solve this issue? All help is appreciated.</p>