简体   繁体   English

开始默认设置为带位图的墙纸意图/活动

[英]Starting default Set as Wallpaper intent / activity with bitmap

I have a bitmap downloaded from a url and want to start android's default set as wallpaper intent/activity passing my bitmap. 我有一个从网址下载的位图,并希望通过我的位图启动android的默认设置为墙纸意图/活动。 I have found following solution but missing value of "R.String.set_as" and "REQUEST_ID_SET_AS_WALLPAPER". 我找到了以下解决方案,但缺少“ R.String.set_as”和“ REQUEST_ID_SET_AS_WALLPAPER”的值。

https://stackoverflow.com/a/26869604/4767525 https://stackoverflow.com/a/26869604/4767525

what should be the value of this fields? 该字段的值应该是什么?

Thanks 谢谢

Don't really know about REQUEST_ID_SET_AS_WALLPAPER. 不太了解REQUEST_ID_SET_AS_WALLPAPER。 I think it is related to the size of the image. 我认为这与图像的大小有关。 R.String.set_as is just a string: "Set as:" R.String.set_as只是一个字符串: "Set as:"

Use this code: 使用此代码:

Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
                intent.setDataAndType(contentUri, "image/*");
                intent.putExtra("mimeType", "image/*");
                intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                startActivity(Intent.createChooser(
                        intent, "Set as:"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM