Android:首选项更改后重新启动或刷新动态壁纸
更改首选项后是否可以重新启动壁纸?
我想我可以用这个来看看这个活动。但如果壁纸已经在运行,我不确定如何更新壁纸。
public void onSharedPreferenceChanged(SharedPreferences prefs) {
}
基本上,我想要一张壁纸,其首选项可以更改画布中使用的位图。
Is it posible to restart a wallpaper after a preference is changed?
I'm thinking I can use this to see the event. But I'm not sure how to update the wallpaper afterwards, if the wallpaper is already running.
public void onSharedPreferenceChanged(SharedPreferences prefs) {
}
Basically, I want to have a wallpaper with a preference that changes a bitmap being used in the canvas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你可以做到这一点,是的,你的想法是正确的。 :-) 最好的起点是查看“第二个”(资源)立方体壁纸 SDK 示例,该示例根据用户首选项更改在 onSharedPreferenceChanged 中更改其模型(立方体与十二面体)。
在该示例中,它们不会扰乱绘图队列 - 只是更改使用的数据,但我不明白为什么您不能删除对可运行对象的回调,然后重新启动绘图过程(如果这更适合)你的目的。
Yes, you can do this, and yes, you've got the right idea. :-) Your best place to start is to look at the "second" (resource) cube wallpaper SDK example, which changes its model (cube vs. dodecahedron) in onSharedPreferenceChanged, based on a user preference change.
In that example, they don't mess with the drawing queue--just alter the data that gets used, but I don't see why you couldn't remove callbacks to your runnable and then restart your drawing process, if that better suits your purpose.