13 января 2012 г. 23:54 пользователь swebb99 <sweb...@gmail.com> написал: > Kostya I think your right, even though the managedCursor mechanism > basically does what I want I don't like it. I think the mechanism you > mention in the destroy method is the way to go with this however I > really think the platform should be looking after all of this > correctly.
That's my thinking too. > > As you say all these things add up. For instance I would have thought > a mechanism to associate an autocomplete field with a database query > would have been built into the platform and I would just need to setup > some simple hooks and the platform would deal with everything. That's my case, which started to trip strict mode on 4.0.2 (apparently its garbage collector is more aggressive than on 3.*). FWIW, here is a snippet from my code: public class SomethingSomething extends AutoCompleteTextView { public SomethingSomething(Context context, AttributeSet attrs) { super(context, attrs); setAdapter(new SomeAdapterClassExtendingCursorAdapter(context)); } public void cleanupAdapter() { CursorAdapter adapter = (CursorAdapter) getAdapter(); adapter.changeCursor(null); } } Activity: onDestroy { mView1.cleanupAdapter(); mView2.cleanupAdapter(); } I suppose the cleanup could be done in the view's onDetachedFromWindow, to make it more self-contained, but I haven't tried it. As it > is I feel like I am trying to jump through hoops and all the time not > working on the real business logic of my app. I hear you :) -- Kostya > > -- > 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 -- 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