Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 停止/启动实时壁纸服务_Android_Live Wallpaper - Fatal编程技术网

Android 停止/启动实时壁纸服务

Android 停止/启动实时壁纸服务,android,live-wallpaper,Android,Live Wallpaper,如何以编程方式在android中停止和启动实时墙纸服务 此代码帮助我向用户发送“从列表中选择我的实时墙纸” if (Build.VERSION.SDK_INT > 15) { i.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER); String pkg = WallpaperService.class.getPackage().getName();

如何以编程方式在android中停止和启动实时墙纸服务

此代码帮助我向用户发送“从列表中选择我的实时墙纸”

if (Build.VERSION.SDK_INT > 15)
        {
            i.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
            String pkg = WallpaperService.class.getPackage().getName();
            String cls = WallpaperService.class.getCanonicalName();
            i.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(pkg, cls));
        }
        else
        {
            i.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
        }
        startActivityForResult(i, 0);

是否有任何方法可以通过编程方式更改用户的实时墙纸?

如果您使用的测试设备的API级别低于15,则无法以您想要的方式更改实时墙纸。!你的代码完全正确。只需在API级别大于15/16的设备上进行测试即可

你解决了这个问题吗?