onCreate called when back from background
android, android-activity, oncreate
Solution
there's a very likely chance that it's a different instance of your activity. The share intent is probably launching your activity on the other app (e.g. dropbox) stack. Making it two instances of your activity class running with two separate `onCreate`
you can check that by pressing the multi-task button on the device and see if you have your application screen-shot preview two times: one with your own app icon, and the other with the other app (e.g. dropbox) app icon.
Problem
Android documentation states that regarding the onCreate method: Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc. This method also provides you with a Bundle containing the activity's previously frozen state, if there was one. Always followed by onStart(). However I have a strange behavior: - I have an Activity A. When I start my application, onCreate is called. That's normal. - I then press the home button. onStop is called. That's normal. - I go back to my application, onCreate is NOT called. That's normal. - I press home again. - I go to another application (dropbox, gmail or whatever) to access a file with an extension that is associated to my application (I have an intent-filter with a pathPattern to this file extension) - I select this file to open it to my app. onCreate is called though onDestroy has never been called. Why is that ? If I set a boolean in my activity to check if this is the first time that I call onCreate, this boolean says true twice (the very first time, and the second time when opening the app using the file extension). I guess I misunderstood something with the onCreate. But the doc doesn't help me. Any idea ?