osmdroid:用户代理不使用片段
Internet上可用的每个示例都告诉我们使用此代码来获取用户代理(没有它,地图将不会加载)。
osm.osmdroid.config.Configuration.getInstance()
.load(applicationContext, this.getPreferences(Context.MODE_PRIVATE))
问题在于 ApplicationContext 产生“未解决的参考”。对于 this.getPreferences()也是如此。
我试图将该代码放入主动脉(没有片段)中,并且有效。 在这种情况下有什么方法可以替换它?
Every example available on the internet tells us to use this line of code to get the user agent (without it the map won't load).
osm.osmdroid.config.Configuration.getInstance()
.load(applicationContext, this.getPreferences(Context.MODE_PRIVATE))
The problem is that applicationContext yields "Unresolved reference". Same goes for this.getPreferences().
I've tried to put that code into MainActivity (no fragments) and it works.
Is there any way to replace it in this context?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案如下:
这是提示列表中的第二个perionencemanager(一个不淘汰的提示。
尽管我不确定是否需要第一行。
The solution is as follows:
It's the second PreferenceManager on the list of hints (the one that is not obsolete.
Although I'm not sure if the first line is even necessary.