You can override onPause and onResume in your activity and keep track of its screen time.
Another, cleaner way is to pass a callback interface reference from your activity to "the other" class instance. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 04.01.2011 16:49 пользователь "Emre A. Yavuz" <[email protected]> написал: > > Hi, > > This question might actually have been brought to developer's attention here on the list before, yet I wasn't able to find a solution after a brief search on the net. > > I have a method in one of my Activity classes which I would like to call from a non-Activity class when the Activity class that the method is a member of is active and running (e.g. in my case the Activity class that I am refering to is in fact a ListActivity class and thus it displays a list of items on the screen when it is running) The problem arises when the non-Activity class, which has a Broadcast Receiver, needs to call this method to update the list. > > Here are my contraints: > > - I can't move the method to a static class > > - I can make neither the Activity class nor the method just by itself static > > Is there any way to retrieve the "context" for the Activity that is currently running ? Maybe I am missing a straight forward solution here. Any suggestions on how to proceed ? > > Thanks in advance, > > Emre > > > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

