如何启动"设置"意图(墙纸,大头贴等) [英] How to start the "set as" intent (wallpaper, contact picture, etc)

查看:275
本文介绍了如何启动"设置"意图(墙纸,大头贴等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索通过网络在过去的几个星期(严重),但我无法找到我所需要的。我只是想入手对应意图在设置为的行动。它一般提供两种设置为壁纸设置为联系人图片。然后,如果有更多的应用程序安装在设备上,它们可以被列在其中。

I searched over the web during the last few weeks (seriously) but I can't find what I need. I just would like to start an intent corresponding to the set as action. It generally offers either Set as wallpaper or Set as contact picture. And then, if more application are installed on the device, they can be listed as well.

下面是我想要的一个例子:

Here is an example of what I want :

我precise,我需要支持的API级别14或更高。 我发现<一href="http://developer.android.com/reference/android/app/WallpaperManager.html#getCropAndSetWallpaperIntent(android.net.Uri)"相对=nofollow> getCropAndSetWallpaperIntent 但它仅适用于内容URI 这对我来说是一个问题,而仅仅是availbable对API拉特19及更高版本。

I precise that I need to support API level 14 and higher. I found getCropAndSetWallpaperIntent but it works only with content URI which is a problem for me, and is only availbable on API lvl 19 and higher.

推荐答案

我发现我自己的答案是:

I found the answer by my self :

Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("jpg", "image/*");
startActivityForResult(Intent.createChooser(intent,
getString(R.string.set_as)), REQUEST_ID_SET_AS_WALLPAPER);

您只需要确保URI是公开的,将可到达由用户选择的作物应用程序。

You just have to ensure that the uri is public and will be reachable by the crop application chosen by the user.

这篇关于如何启动&QUOT;设置&QUOT;意图(墙纸,大头贴等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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