0

I wanted to ask you if someone knows how to detect when an external app runs one of this methods. I'm working with some classmates in a project where we want to examinate the response time of other applications. The idea is to measure the time between the run of each method to get an aproximation of the response time when opening the app.

Is this possible to achieve?

lmambrilla
  • 19
  • 3
  • 3
    if you read the documentation it will tell you http://developer.android.com/reference/android/app/Activity.html#onStart() http://developer.android.com/reference/android/app/Activity.html#onResume() – tyczj May 21 '14 at 16:06
  • 1
    are you looking for someone to copy/paste the documentation for you? what more information can you expect than what is very well documented in the doc linked by @tyczj ? (if there is a particular point that is unclear, you need to be more specific about it.) – njzk2 May 21 '14 at 16:13
  • 1
    possible duplicate of [Difference between onStart() and onResume()](http://stackoverflow.com/questions/4553605/difference-between-onstart-and-onresume) – stealthjong May 21 '14 at 17:07
  • Sorry, i have edited my answer. – lmambrilla May 21 '14 at 17:31

3 Answers3

4

Look at the android's application lifecycle diagram.

onStart() is called when an Activity is created(new activity created when user gets to it) or restarted(when a backgrounded activity comes back).

onResume() is called when an activity is started and when it cames back from being paused.

enter image description here

Aboca
  • 575
  • 2
  • 9
1

onStart is called after a fully obscured activity comes to foreground (or when it first comes to foreground).

onResume is called after onStart and it is also called after a partially obscured activity comes to foreground. That is, onResume is called after a fully or a partially obscured activity comes to foregorund.

When a partially obscured activity comes to foregound onStart does not get called.

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
1

We can't live without onStart because that is the state when the activity becomes "visible" to the user, but the user cant "interact" with it yet may be cause it's overlapped with some other small dialog. This ability to interact with the user is the one that differentiates onStart and onResume. Think of it as a person behind a glass door. You can see the person but you can't interact (talk/listen/shake hands) with him. OnResume is like the door opener after which you can begin the interaction.

this question is answered here, there are very good examples

onresume and onStart

Community
  • 1
  • 1
sai Gorantla
  • 179
  • 9