android - Will a Handler defined in an Activity leak in this scenario -


i've got activity handler defined:

final handler updatehandler = new handler() {     public void handlemessage(message msg) {        // stuff.     } }; 

in oncreate method, if assign handler static list outside of activity, leak (or rather, outside list keep reference activity forever)? i.e,:

@override public void oncreate(bundle savedinstancestate) {                 somestaticclass.addhandler(updatehandler); }  ...  public class somestaticclass {     static list<handler> handlers = new arraylist<handler>();      public static void addhandler(handler handler) {          handlers.add(handler);     } } 

in oncreate method, if assign handler static list outside of activity, leak (or rather, outside list keep reference activity forever)?

yes. not put handlers in static data members.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -