开发者

MapActivity with loader framework

Is there any solution for using the a MapView (and thus the 开发者_开发知识库MapActivity) with the honeycomb pre-3.0 compatibility Loader library (and thus FragmentActivity)?

(as an aside, I never quite understood why one needed to extend MapActivity in order to use the map - it's terribly limiting when writing generic activities. Wouldn't an interface be more appropriate?)


At Carter Jernigan's suggestion received out-of-band, I ended up taking the source of the compat library and put a copy of everything in the android.support.v4.app package into my own source tree under the package android.support.v4_map.app. Then I modified the FragmentActivity to inherit from MapActivity instead of Activity and named it MapFragmentActivity. It's a fairly crude hack, but it works well (so far). I now have all the benefit of the LoaderManager.

As an aside, trying to use CursorLoaders without a LoaderManager is a recipe for lots of unclosed cursors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜