Refresh screen from within BillingReceiver
<p>I have an app comprised of multiple activities. There are multiple items that may be purchased. What is displayed within each activity may vary depending on what has been purchased. I have a <code>BillingReceiver</code> with a <code>purchaseStateChanged()</code> method. What I need to do inside <code>purchaseStateChanged()</code> is to say, whichever activity is running, please invalidate?/refresh? the screen. Is there a standard way of doing this?</p>

<p><strong>EDIT:</strong> Looking at Simon's comment and just to make it easier to answer, let us say that when the BillingReceiver receives a call to purchaseStateChanged() one of two activities could be running, ActivityA or ActivtyB. These activities both contain methods <code>void redraw_everything()</code> which are both declared as: </p>

<pre><code>void redraw_everything()
{
    getWindow().getDecorView().invalidate();
}
</code></pre>

<p>I don't know the syntax for setting up a callback, but I guess the answer may look something like:</p>

<p>In onCreate of both activities we should say something like:</p>

<pre><code>BillingReceiver.setupcallback(redraw_everything()); // ??
</code></pre>

<p>and in the onDestroy() methods have something like:</p>

<pre><code>BillingReceiver.setupcallback(null); // ??
</code></pre>

<p>Then in BillingReceiver make a method something like:</p>

<pre><code>??? stored_method_to_call;

void setupcallback(???? method_to_call)
{
     stored_method_to_call = method_to_call;
}
</code></pre>

<p>then inside purchaseStateChanged() have some code like:</p>

<pre><code>if (stored_method_to_call != null) // ?? not sure about syntax
{
    stored_method_to_call(); // ?? not sure about syntax
}
</code></pre>
