带有加载器框架的 MapActivity
是否有任何解决方案可以将 MapView
(以及 MapActivity
)与 honeycomb pre-3.0 兼容性 Loader
库(以及 MapActivity
)一起使用>FragmentActivity)?
(顺便说一句,我一直不太明白为什么需要扩展 MapActivity
才能使用地图 - 在编写通用活动时它有很大的限制。接口不是更合适吗?)
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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Carter Jernigan 的带外建议,我最终获取了 compat 库的源代码,并将
android.support.v4.app
包中所有内容的副本放入我自己的源代码树中包android.support.v4_map.app
。然后我修改了FragmentActivity
以继承MapActivity
而不是Activity
并将其命名为MapFragmentActivity
。这是一个相当粗糙的黑客,但效果很好(到目前为止)。我现在可以享受LoaderManager
的所有好处。顺便说一句,尝试在没有 LoaderManager 的情况下使用 CursorLoader 会导致大量未关闭的游标。
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 packageandroid.support.v4_map.app
. Then I modified theFragmentActivity
to inherit fromMapActivity
instead ofActivity
and named itMapFragmentActivity
. It's a fairly crude hack, but it works well (so far). I now have all the benefit of theLoaderManager
.As an aside, trying to use
CursorLoader
s without aLoaderManager
is a recipe for lots of unclosed cursors.