几个线程=几个应用程序上下文?
过去三天一直让我头疼:
我有一个 MyApp 扩展应用程序。 当我从我的服务(在不同线程中运行)调用 getApplication() 时,我得到的 MyApp 实例与我从主线程中运行的 activites 调用 getApplication() 时得到的实例不同。
这是正常行为吗?
it's been giving me headaches for the past 3 days :
I have a MyApp extending Application.
When I call getApplication() from my services (running in different threads), I get a different instance of MyApp than when I call getApplication() from activites running in the main thread.
Is that a normal behavior ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非您的服务在不同的进程中运行,否则这种情况不会发生。您确定它们实际上是不同的实例吗?你在什么平台上测试?
Unless your services are running in different processes this shouldn't happen. Are you sure they are actually different instances? On what platform are you testing?