Reputation: 2096
I have a problem. All my activities are without methods onStart and onStop. All the code is inside onCreate. All activities are ended with finish();
But I want to integrate Google analytics inside my project. The instructions are following:
public void onStart() {
super.onStart();
EasyTracker.getInstance().activityStart(this); // Add this method.
}
@Override
public void onStop() {
super.onStop();
EasyTracker.getInstance().activityStop(this); // Add this method.
}
Shall I just create these methods and leave them empty? Or I can put EasyTracker methods inside onCreate ?
Upvotes: 1
Views: 339
Reputation: 11323
just add this methods code like you posted in your question.
The thing is: All Activities have onStart()
and onStop()
methods, you are just overriding them to add some additional code (here the analytics tracker) when the Activity changes its state.
Take a look at this activiy life-cycle diagram here: http://developer.android.com/training/basics/activity-lifecycle/stopping.html
Upvotes: 1