Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

removePhaseListener() does NOT work  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a PhaseListener I want to conditionally add to a Lifecycle. When the conditions are right, it successfully uses lifecycle.addPhaseListner(myConditionalListener) and it processes just fine. At the end of that cycle I want to remove that phaseListener with lifecycle.removePhaseListener(myConditionalListener) The code runs but the listener remains until I restart the application.

I have tried both

currentLifecycle.removePhaseListener(cpl);
context.getViewRoot().removePhaseListener(cpl);

With no effect.

Since this listner is costly in terms of performance and only needed in a particular set of conditions, I wanted to use removePhaseListener and I have several such conditional listeners. I would prefer if this works or if I need to do something else in addition to this or instead of this, but I can always have a customeListener that did the logic and was always in there and had its own factory but that's a kludge since removePhaseListener is there it should work, yes?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!