android 从广播接收器获取偏好
嗯,我是一个 Android 新手。我正在尝试编写一个应用程序,其中一个活动启动另一个活动(首选项活动),以及一个BoradcastReceiver。它们都在三个不同的文件中。我的问题是:如何在这些组件之间共享首选项,例如如何从广播接收器读取首选项活动中设置的首选项?
Well, i am an Android newbie. I am trying to write an application which has one activity which starts another activity (Preference Activity), and one BoradcastReceiver. They are all in three different files. My question is: How to share Preferences betweens these components, e.g. how to read preferences that are set in Preference Activity from Broadcast Receiver?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我之前问过同样的问题,这是我使用的代码:
我启动的服务什么也不做,我只是启动一个,因为我认为它只是帮助广播接收器工作。此外,这个广播接收器也在我的清单中注册,如下所示:
在启动时启动,需要权限
android.permission.RECEIVE_BOOT_COMPLETED
可以找到对我的问题的参考此处
PS 欢迎来到堆栈溢出
I have asked this same exact question before and here is the code I used:
The service that I start does nothing I just initiate one because I think it just helps the broadcast receiver work. Also this broadcast receiver is registered in my manifest like so:
Which starts on bootup requiring the permission
android.permission.RECEIVE_BOOT_COMPLETED
Reference to my question can be found here
P.S. Welcome to stackoverflow