Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you might be looking for is <a href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP" rel="nofollow">FLAG_ACTIVITY_CLEAR_TOP</a> intent flag:</p> <blockquote> <p>If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.</p> </blockquote> <pre><code>Intent i = new Intent(..); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); </code></pre> <p>and then start Activity with this intent.</p> <p>See more on tasks and back stack in documentation: <a href="http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html" rel="nofollow">Tasks and Back stack</a>. </p> <p>However to implement login/logout to application (if it is not communicating with online service) you might use <a href="http://developer.android.com/reference/android/content/SharedPreferences.html" rel="nofollow">SharedPreferences</a>. This way on application start you could check if user is logged in (eg. some flag turned on in preferences) and upon application exit (eg. by button) you could clear this flag.</p> <p>Killing/removing Activities should be left to the system. Per system design it is Android OS that is responsible for application lifetime.</p> <p>For example check the <a href="http://code.google.com/p/android-passwordsafe/" rel="nofollow">Password Safe</a> application sources. It needs password every time you open fresh instance of application.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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