passcode on application is resumed
<p>how to distinguish when app is minimized or a new activity starts?</p>

<p>i wanna implement a passcode like in dropbox app, wherein when the app is minimized it will ask for passcode if the app resumed. this is what i have in mind.</p>

<pre><code>public static Boolean isMinimized = false;
@Override
public void onResume() {
      super.onResume();
      if(isMinimized)
      {
          isMinimized = false;
          startActivity(new Intent(this, Login.class));
      }
}

@Override
public void onPause() {
      super.onPause();
      isMinimized = true;
      Toast.makeText(this, "Application Minimized", Toast.LENGTH_LONG).show();
}
</code></pre>

<p>when i run a new activity i set the isMinimized to false so the login wont popup, however when i minimized it, and return to it, onPause is always triggered since it again paused.</p>

<p>by using getParent() how can i dynamically change static variables.</p>

<p>NOTE: i cannot use casting since its not static who calls this activity</p>

<p>i change the value of isMinimized using im 100% sure the SystemPreferences is the parent.</p>

<pre><code>SystemPreferences.isMinimized = false;
</code></pre>

<p>however, is there a way to cast getParent() so i can using something like</p>

<pre><code>((SystemPreferences) getParent()).isMinimized = false;
</code></pre>

<p>take note: the parent is dynamic.</p>
