Sunday, May 15, 2011

[android-developers] Re: keeping track of time a user is actively using an android app

You can use a base class for all activty and use the timer code
within that class
if your program is long you wont have to artie the code in every class

On May 15, 12:51 am, TreKing <treking...@gmail.com> wrote:
> On Fri, May 13, 2011 at 2:58 PM, laurent bouis <lbou...@gmail.com> wrote:
> > I did some research and the only suggestion I found so far is using the
> > onResume() and onPause() methods of activities to keep track of elapsed time
> > between those 2 calls; I would probably need to do this in each activity of
> > the application which doesn't seem to be a very elegant solution.
>
> Probably as good as it's going to get. Check out the delegation patterns
> discussed in this thread:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> You could easily have a delegate object that tracks the time spent in a
> given activity by calling mDelegate.startTiming() / mDelegate.stopTiming()
> in onStart() / onStop(), respectively, in each activity.
>
> Note that you should use the onStart() / onStop() pair. If you show a
> dialog, for example, your activity is still in use but it gets onPause()
> called.
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate