android-lifecycle

issue with program flow when rotating device with two activities

My first activity is creating a second activity within its onCreate: if (userName == null || password == null) { if (!getUserNameAndPassword() ) { // User is launching this for the first time Intent explicitIntent = new Intent(CreateSessionAlert.this,CreateUserNameAndPassword.class);<br> startActivityForResu...

In Android, how can I detect why my activity was resumed?

I'm developing an Activity that does some of its own state management. I'm trying to differentiate the following onResume cases: New launch task switch (home button long-click) resume after other activity in the same application wake-up after sleep orientation change Is there something in the Activity's intent, or elsewhere, that ca...

Android; How can I initialise state in one activity, then have another refresh that?

I have two activities The first one gets some data from a content provider, and displays it The second activity has a button, and when clicked it should call the first activity to "refresh", in other words to reload data from the content provider This is my first activity ... @Override public void onCreate(Bundle savedInstanceSta...

android weird onCreate / onDestroy balance

Hi, is there a way to tell Android that I would like subsequent calls to startActivity() all resume the target activity rather than creating it over and over again ? Any workarounds ? Thanks ...

Question about activity lifecycle: onNewIntent / onSaveInstanceState

I have ActivityLanding which calls an activity called ActivityFolder. In the intent I used putExtra("folderId", "...") (I know folderId is not the best example) I can store that to a variable and use it just fine but if eventually my activity gets killed to save memory I may lose the folderId. When my activity gets launched again,, will...

Selecting Activities from History Stack

If a user opens my app they may open the following activities ActivityLanding ActivityFolder (foldera) ActivityFolders (they select a new folder and this activity gets finished) ActivityFolder (folderb) ActivityFolders (now right here... If the user selects foldera (again) then they will get two ActivityFolder instances in their stac...