Activity history stack wrong upon first install on device?
<p><strong>Edit / Update:</strong></p>

<p>As an update to the below problem, I found the exact action which causes it to happen.</p>

<ol>
<li>Download an apk from a url through the android browser</li>
<li>Install the app.</li>
<li>After install, the app gives you two choices: "Open" or "Done".</li>
<li>If you choose "Open", the quirky behavior described below starts.</li>
<li>If you choose "Done", then launch the app from the app tray, it works fine.</li>
</ol>

<p>So it seems like this problem is caused by using the "Open" button the browser provides you after installing the APK.</p>

<p><hr></p>

<p>I'm experiencing an error in the history stack of applications upon first install. I made a test app to demonstrate this.</p>

<p>The test app is simply two activities, A and B. Activity A launches B. That's all it does. Rest is wizard generated template code from eclipse.</p>

<p>When the user installs the app (via web url apk), and runs it for the <em>first</em> time, I get an out-of-order activity stack:</p>

<p>-User starts the app, A is on top.<br>
  -They make A launch B by clicking a button. B is on top of the stack.<br>
  -User hits the home screen button.<br>
  -User returns to the app, A is displayed, instead of B.<br>
  -User hits the back key, B is shown!<br>
  -User hits the back key again, A is shown!<br>
  -User hits the back key again, home screen shown.<br>
  -Now the stack is clean, and app behaves "normally" from now on!  </p>

<p>Is any one else seeing this? This is almost exactly like this known bug, however my users are not installing from eclipse:
<a href="http://code.google.com/p/android/issues/detail?id=2373&amp;q=first%20%20i" rel="nofollow">http://code.google.com/p/android/issues/detail?id=2373&amp;q=first%20%20i</a>...</p>

<p>I can provide the test app/source if anyone wants to try. This is the manifest, which does not have any special customizations made to it.</p>

<pre><code>&lt;activity android:name=".ActivityA"
          android:label="ActivityA"
  &gt;
  &lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.MAIN" /&gt;
    &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
  &lt;/intent-filter&gt;
&lt;/activity&gt;

&lt;activity android:name="ActivityB"
          android:label="ActivityB"
  &gt;
  &lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.VIEW" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  &lt;/intent-filter&gt;
&lt;/activity&gt;
</code></pre>

<p>as far as I know, this should definitely not be happening, and works fine after you clear the history stack the first time.</p>

<p>Thanks</p>
