Note that there are some explanatory texts on larger screens.

plurals
  1. POActivity lifecycle - some strange behavior. Can't duplicate
    text
    copied!<p>That might be broad question but I will try to explain best. I will also give code snippets if anything jumps out - please let me know.</p> <p>I can't repro this issue but it surface itself like so:</p> <p>a. Sometime I would be logged in - I hit log out and will see my Activity refreshed. And that can happen many times. What I expect is Activity to close when I hit logout.</p> <p>b. Sometime I'm on my Activity (already logged in) and started from icon. And I click back and it wouldn't go to "desktop" and goes to activity again. And this can happen 1-3 times. I expect since this is main activity to go back to desktop when hit back.</p> <p>c. I noticed similar kind of issue on Yahoo mail app so I'm not sure if that is bug or 2.3.1 issue on my Nexus S? </p> <p>I have: 1. Main activity 2. Login dialog that is custom dialog.</p> <p>This is code from my activity:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //If not authorized yet then show sign in dialog if (!PreferencesManager.getIsUserAuthenticated(getApplicationContext())) { showDialog(1); } Button signOutButton = (Button) findViewById(R.id.SignOutButton); signOutButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { PreferencesManager.setIsUserAuthenticated(false, getApplicationContext()); **MainActivity.this.finish();** } }); } @Override protected void onDestroy() { super.onDestroy(); } @Override protected void onPause() { super.onPause(); } protected Dialog onCreateDialog(int id) { LoginDialog dialog = new LoginDialog(this); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(DialogInterface dialog) { if (!PreferencesManager.getIsUserAuthenticated(getApplicationContext())) { **MainActivity.this.finish();** } } }); return dialog; } </code></pre> <p>In dialog class - I have regular stuff and "this.dismiss" if Login was successfull.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload