I'm developing an app that runs both on Android and JSE/Swing so there's a platform-independent part (~90% of code) that operates in terms of interfaces for UI (sqlite, xmlpullparser, etc.) with implementations being provided by a homebrew 'DependencyContainer'. At the very beginning of app startup implementations get "injected" and later fetched at runtime. No probs on desktop, on Android everything works until the first context change (e.g. press 'back' and then launch the app againg so that onCreate() gets called). So, what I do in onCreate() is null all the Context-dependent items and recreate them providing the new context. Unfortunately, this doesn't work. Say, I simplify it down to having a single ListView with some items and OnClickListener that i store into DependencyContainer first, then fetch it and set it in setContentView(). Here's how it works: 1. Launch app - got ListView with items, OnClickListener works as expected 2. Hit back. 3. Launch again, the ListView is empty, clicking on it will crash the app which is caused by a nullpointer in onClick() 4. After the crash, launch again - works as expected The odd thing is that in debug mode a breakpoint set on onClick() somehow isn't even reached!
Is there some sort of View caching or smth? Any suggestions? TIA. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

