[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Sujay Krishna Suresh
Yes, it is best to do that...
But i tried adding this as a ShutdownHook, but it failed to execute on app
exit...
I'd suggest that u release resources used by an activity in its onDestroy
method.

On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:


 i have some static variables and some registerListeners.
 Do i need to release them all and remove these listeners?
 



-- 
Regards,
Sujay
Lenny Bruce http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
- Communism is like one big phone company.

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Ivy

I register a SensorListener,where should i unregister it?
In which method?
And how to release statics?

On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
wrote:
 Yes, it is best to do that...
 But i tried adding this as a ShutdownHook, but it failed to execute on app
 exit...
 I'd suggest that u release resources used by an activity in its onDestroy
 method.

 On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:

  i have some static variables and some registerListeners.
  Do i need to release them all and remove these listeners?

 --
 Regards,
 Sujay
 Lenny Bruce http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
 - Communism is like one big phone company.
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Sujay Krishna Suresh
primitive statics will be taken care. jus make others null.
in onPause() unregister  in onResume register again.

2009/7/16 Ivy ytang1...@gmail.com


 I register a SensorListener,where should i unregister it?
 In which method?
 And how to release statics?

 On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
 wrote:
  Yes, it is best to do that...
  But i tried adding this as a ShutdownHook, but it failed to execute on
 app
  exit...
  I'd suggest that u release resources used by an activity in its onDestroy
  method.
 
  On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:
 
   i have some static variables and some registerListeners.
   Do i need to release them all and remove these listeners?
 
  --
  Regards,
  Sujay
  Lenny Bruce 
 http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
  - Communism is like one big phone company.
 



-- 
Regards,
Sujay
Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html  -
If God had wanted man to play soccer, he wouldn't have given us arms.

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Ivy

Thank  you for answer, but i have another question...

How to release these static methods...

And can i use the finalize to unregister the listener?

On 7月16日, 下午7时53分, Sujay Krishna Suresh sujay.coold...@gmail.com
wrote:
 primitive statics will be taken care. jus make others null.
 in onPause() unregister  in onResume register again.

 2009/7/16 Ivy ytang1...@gmail.com







  I register a SensorListener,where should i unregister it?
  In which method?
  And how to release statics?

  On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
  wrote:
   Yes, it is best to do that...
   But i tried adding this as a ShutdownHook, but it failed to execute on
  app
   exit...
   I'd suggest that u release resources used by an activity in its onDestroy
   method.

   On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:

i have some static variables and some registerListeners.
Do i need to release them all and remove these listeners?

   --
   Regards,
   Sujay
   Lenny Bruce 
 http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
   - Communism is like one big phone company.

 --
 Regards,
 Sujay
 Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html  -
 If God had wanted man to play soccer, he wouldn't have given us arms.- 
 隐藏被引用文字 -

 - 显示引用的文字 -
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Sujay Krishna Suresh
Never use finalize for anything
i dont no if u can release static METHODS...

2009/7/16 Ivy ytang1...@gmail.com


 Thank  you for answer, but i have another question...

 How to release these static methods...

 And can i use the finalize to unregister the listener?

 On 7月16日, 下午7时53分, Sujay Krishna Suresh sujay.coold...@gmail.com
 wrote:
  primitive statics will be taken care. jus make others null.
  in onPause() unregister  in onResume register again.
 
  2009/7/16 Ivy ytang1...@gmail.com
 
 
 
 
 
 
 
   I register a SensorListener,where should i unregister it?
   In which method?
   And how to release statics?
 
   On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
   wrote:
Yes, it is best to do that...
But i tried adding this as a ShutdownHook, but it failed to execute
 on
   app
exit...
I'd suggest that u release resources used by an activity in its
 onDestroy
method.
 
On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:
 
 i have some static variables and some registerListeners.
 Do i need to release them all and remove these listeners?
 
--
Regards,
Sujay
Lenny Bruce 
  http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
- Communism is like one big phone company.
 
  --
  Regards,
  Sujay
  Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html
  -
  If God had wanted man to play soccer, he wouldn't have given us arms.-
 隐藏被引用文字 -
 
  - 显示引用的文字 -
 



-- 
Regards,
Sujay
Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html
- Computers are useless. They can only give you answers.

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Yusuf T. Mobile

You don't need to release the static variable. For the finalize-is-
discouraged and other Android code style rules, see:
http://source.android.com/submit-patches/code-style-guide



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Jul 16, 6:32 am, Sujay Krishna Suresh sujay.coold...@gmail.com
wrote:
 Never use finalize for anything
 i dont no if u can release static METHODS...

 2009/7/16 Ivy ytang1...@gmail.com







  Thank  you for answer, but i have another question...

  How to release these static methods...

  And can i use the finalize to unregister the listener?

  On 7月16日, 下午7时53分, Sujay Krishna Suresh sujay.coold...@gmail.com
  wrote:
   primitive statics will be taken care. jus make others null.
   in onPause() unregister  in onResume register again.

   2009/7/16 Ivy ytang1...@gmail.com

I register a SensorListener,where should i unregister it?
In which method?
And how to release statics?

On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
wrote:
 Yes, it is best to do that...
 But i tried adding this as a ShutdownHook, but it failed to execute
  on
app
 exit...
 I'd suggest that u release resources used by an activity in its
  onDestroy
 method.

 On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:

  i have some static variables and some registerListeners.
  Do i need to release them all and remove these listeners?

 --
 Regards,
 Sujay
 Lenny Bruce 
   http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
 - Communism is like one big phone company.

   --
   Regards,
   Sujay
   Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html
   -
   If God had wanted man to play soccer, he wouldn't have given us arms.-
  隐藏被引用文字 -

   - 显示引用的文字 -

 --
 Regards,
 Sujay
 Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html
 - Computers are useless. They can only give you answers.
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Do i need to release the static variable and remove the listener when the app is closed?

2009-07-16 Thread Dianne Hackborn
You really probably shouldn't be putting actively registered listeners in
statics.  It should be associated with your activity, in which class it is
very clear when to unregister.

2009/7/16 Ivy ytang1...@gmail.com


 I register a SensorListener,where should i unregister it?
 In which method?
 And how to release statics?

 On 7月16日, 下午7时39分, Sujay Krishna Suresh sujay.coold...@gmail.com
 wrote:
  Yes, it is best to do that...
  But i tried adding this as a ShutdownHook, but it failed to execute on
 app
  exit...
  I'd suggest that u release resources used by an activity in its onDestroy
  method.
 
  On Thu, Jul 16, 2009 at 5:03 PM, Ivy ytang1...@gmail.com wrote:
 
   i have some static variables and some registerListeners.
   Do i need to release them all and remove these listeners?
 
  --
  Regards,
  Sujay
  Lenny Bruce 
 http://www.brainyquote.com/quotes/authors/l/lenny_bruce.html
  - Communism is like one big phone company.
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---