How to return to my original activity when new activity is closed?
<p>I have an app used as a remote control for an industrial process, with 3 activities A, B, and GraphicsActivity.   A is the main activity and B is another screen with additional features the user can access.</p>

<p>There's also a separate stand-alone class, PCComms, which runs in its own thread and handles communication with the PC which controls the industrial process.   Every so often the PC sends the Android an image to display and PCComms will fire off GraphicsActivity to display it to the user.  The user taps a button to close it.</p>

<p><strong>This is the problem:</strong>  when the user closes GraphicsActivity it always returns to A, even if the user was in B at the time.</p>

<p>PCComms is not an activity, just a generic class so it needs an activity context so I have a context variable that gets updated by whichever Activity had the screen at the time the graphics was displayed:</p>

<pre><code>Intent intent = new Intent(curContext, GraphicsActivity.class);
intent.putExtra("Caption", sGCaption);                                
curContext.startActivity(intent);
</code></pre>

<p>... I've confirmed in the debugger that curContext is B's context.
When GraphicsActivity launches, B's <em>onPause()</em> gets called but none of B's life-cycle events get called when GraphicsActivty <em>finish()</em> es.</p>

<p>relevant manifest entries . . . </p>

<pre><code>&lt;activity android:name="A"
   android:launchMode="singleTask"
   android:screenOrientation="portrait"&gt;
&lt;/activity&gt;
&lt;activity android:name="B"
   android:screenOrientation="portrait"
   android:launchMode="singleInstance"&gt;
&lt;/activity&gt;
&lt;activity android:name="GraphicsActivity"
   android:screenOrientation="portrait"
   android:launchMode="standard"&gt;
&lt;/activity&gt;
</code></pre>

<p>So if I'm in B when GraphicsActivity is opened, how do I get it to return to B when GraphicsActivity is closed?</p>

<p>Thanks in advance!</p>
