Android的 - 使用&QUOT设置壁纸,设置壁纸"意图 [英] Android - Set Wallpaper using the "Set Wallpaper" intent

查看:239
本文介绍了Android的 - 使用&QUOT设置壁纸,设置壁纸"意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人问这里和的here~~V 但没有真正的答案。

The question was asked here and here but there was no real answer.

Android有一个内置的设置墙纸功能,从哑剧为image / jpeg的活动意图时,这种功能可或长攻的图像浏览器。

Android has a built-in "Set Wallpaper" feature, such feature is available when starting an activity intent with mime "image/jpeg" or long-tapping on images in browser.

我的问题是:如何以编程方式使用文件调用内置的设置墙纸功能乌里

My question is: how do I programmatically invoke the built-in "Set Wallpaper" feature using a file Uri?

推荐答案

好像是没有答案的问题,但是我却发现了一个解决方法:

Seems like there is no answer to the question however I did discover a workaround:

    Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setDataAndType(uri, "image/jpeg");
    intent.putExtra("mimeType", "image/jpeg");
    this.startActivity(Intent.createChooser(intent, "Set as:"));

这篇关于Android的 - 使用&QUOT设置壁纸,设置壁纸"意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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