使用ACTION_SET_WALLPAPER设置壁纸

时间:2015-07-21 11:56:46

标签: android bitmap wallpaper

我目前正在设置壁纸使用壁纸管理器传递一个位图这是有效的,但这个图像是静态的,所以它不随屏幕移动,它不会给我一个裁剪图像的选项。我想在我调用时使用ACTION_SET_WALLPAPER,它可以保存图像,但是当它试图将图像设置为裁剪时,它会给我一个“无法加载图像”并退出我的应用程序,

我的尝试

java.lang.IllegalArgumentException: URI is not absolute: /storage/emulated/0//my_tmp_file.png
        at java.net.URI.toURL(URI.java:1376)
        at com.lge.gallery.data.UriImage$JobState.openOrDownloadInner(UriImage.java:147)
        at com.lge.gallery.data.UriImage$JobState.openFileOrDownloadTempFile(UriImage.java:105)
        at com.lge.gallery.data.UriImage$JobState.prepareInputFile(UriImage.java:198)
        at com.lge.gallery.data.UriImage$BitmapJob.getBitmap(UriImage.java:256)
        at com.lge.gallery.data.UriImage$BitmapJob.run(UriImage.java:249)
        at com.lge.gallery.data.UriImage$BitmapJob.run(UriImage.java:240)
        at com.android.gallery3d.app.CropImage$LoadBitmapDataTask.run(CropImage.java:1490)
        at com.android.gallery3d.app.CropImage$LoadBitmapDataTask.run(CropImage.java:1483)
        at com.lge.gallery.util.ThreadPool$Worker.run(ThreadPool.java:167)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
        at 
 com.lge.gallery.util.PriorityThreadFactory$1.run
(PriorityThreadFactory.java:43)
07-23 00:47:26.395  26470-26470/? I/StorageStateManager﹕     
rootPath=/storage/emulated/0/ available_size=5782491136 request_size=1500000
07-23 00:47:26.395  26470-26470/? I/FloatableActivity﹕ onPostResume  
 activity=com.android.gallery3d.app.CropImage
(com.android.gallery3d.app.CropImage@149b6d72)
07-23 00:47:26.450  26470-26470/? I/FloatableActivity﹕ on attached from   
window activity=com.android.gallery3d.app.CropImage
07-23 00:47:26.530  26470-27056/? I/GalleryEGLConfigChooser﹕ Config chosen:   
 R8 G8 B8 A0 D0 S8 ID12 CAVEAT12344
07-23 00:47:26.540  26470-27056/? I/GLRootView﹕ onSurfaceChanged: 1440x2200,   
gl10: com.google.android.gles_jni.GLImpl@18efc101
07-23 00:47:26.541  26470-27056/? I/GLRootView﹕ layout content pane 1440x2200
07-23 00:47:26.568    1050-1151/? I/SystemUI[Framework]﹕   
PhoneWindowManager.updateSystemUiVisibilityLw() :visibility=0x8600,   
pkg=com.android.gallery3d
07-23 00:47:26.569    1461-1461/? I/[SystemUI]NavigationThemeResource﹕ notify   
navigation bar color(0xff000000)
07-23 00:47:26.570    1050-1151/? W/PhoneWindowManagerEx﹕   
Call!!!getLGSystemUiVisibility. =0x0
07-23 00:47:26.570    1050-1151/? I/SystemUI[Framework]﹕ ==>disabledNaviBtn()   
what=0x0, token=android.os.Binder@64e735,  pkg=WindowManager.LayoutParams 
07-23 00:47:26.570    1050-1151/? I/SystemUI[Framework]﹕ disableNaviBtn:   
mDisabledNaviBtn=0x0,  mDisableRecords.size=0
07-23 00:47:26.570    1461-1461/? I/[SystemUI]NavigationThemeResource﹕   
NavigationKey Color is changed(WHITE_WITH_SHADOW -> WHITE)
BarMode=4, Theme=BLACK, LightBackground=false (NOT Transparent)

仍然倾注我的代码保存图像,然后询问用户想要设置图像的内容,然后仍然使用toast cant load image崩溃,如果我去文件管理器我可以选择我有的图像刚保存并将其设置为壁纸没有问题是否有人可以告诉我为什么这不起作用?

stacktrace ...

phpinfo()

1 个答案:

答案 0 :(得分:0)

经过几天的搜索,我设法用这个家伙回答here

来解决这个问题