用setbitmap()android即时设置墙纸 [英] Setting wallpaper instantly with setbitmap() android

查看:91
本文介绍了用setbitmap()android即时设置墙纸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找问题的答案,但似乎找不到正确的答案.

I have been searching for an answer to my problem, but cant seem to find a right answer.

每次歌曲更改时,我都试图使用Tasker在手机上设置背景.我一切正常,但setbitmap不会立即设置墙纸.我必须以某种方式与手机互动才能更新手机(打开文件夹,触摸屏幕等).在setbitmap被调用之后,是否有一种方法可以强制进行更新?

I am trying to use tasker to set a background on my phone everytime a song changes. I got everything working, but setbitmap does not set wallpaper instantly. I have to interact with the phone in some way to get it to update ( open a folder, touch the screen etc). Is there a way to force an update after setbitmap has been called?

我现在正在使用setStream.这是一个简短的视频,展示了我试图详细解释的内容.

Im using setStream now. Here is a short video showing what im trying to explain in detail.

壁纸延迟

谢谢!

推荐答案

您的权限是否到位?

<uses-permission android:name="android.permission.SET_WALLPAPER" />


另外,您可以使用setStream代替setBitmap,因为它需要花费时间来解码一个位图,并且它与位图的大小成正比.


Alternatively you can use setStream instead of setBitmap as it takes time to decode a bitmap and it is directly proportional to the size of the bitmap.

这篇关于用setbitmap()android即时设置墙纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆