Let's say a user is using my Android app, I have a DialogFragment YourTanks
(it shows the various tanks you own!)
public class YourTanks extends DialogFragment implements View.OnClickListener
So again, the user is literally looking at that "page", seeing their tanks and so on.
They get a phone call or decide to use another app, perhaps their calendar, email, whatever.
Note that, of course, my app does not quit, it's still running in the background.
They finish with the other app. On the home screen or app screen of the Android, they click the icon of my app. Now, my app appears again and once again they can see their colourful tanks, etc.
So - I want to know that they have opened the app, I want YourTanks to be alert to that.
@Override
public void onStart ()
{
super.onStart();
Utils.Log("WE ARE IN onStart !!========");
Utils.Log("I think this means the user just 'opened' or 'reopened' the app.");
Utils.Log("Better ask on SO though.");
}
Indeed, is this the best way to do what I describe, or, do you have to do something at (perhaps/) the activity level, or some other concept?
(Note that on iPhone, for instance, you more or less use something like -(void)applicationDidBecomeActive:(UIApplication *)application
in the overall application singleton.)
you need onResume instead, the activity could just be paused when the app is re-opened, This function is also called after onCreate.
http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle Here is the documentation how it's all called and working.