How do I dynamically invoke a certain Activity based only on the parent?
<p>I have a class in my project that is used as a helper throughout all my Activities.
On the <code>onCreate</code> method, I instanciate this class like this:</p>

<pre><code>MyClass myClass = new MyClass(getApplicationContext());
</code></pre>

<p>Now, the MyClass class holds the context of the one who instantiated it.</p>

<p>At some moment of this class, depending on what value I have computed, I want to refresh the Activity that instantiated the class. Right now I am doing the following:</p>

<pre><code>Intent myIntent = new Intent(parentContext, LoginActivity.class);
parentContext.startActivity(myIntent);
</code></pre>

<p>As you can see, I am hard coding the <code>LoginActivity.class</code>. What I want to achieve really is to start the activity based on the context. Something like this:</p>

<pre><code>Intent myIntent = new Intent(parentContext, parentContext.getActivity().getClass());
</code></pre>

<p>Does that make sense? I want to be able to dynamically refresh any activity that has given its context to the class. Is that possible?</p>

<p>Or maybe I should think of a different design?</p>

<p>Many thanks,
Felipe</p>
