How to start the “set as” intent (wallpaper, contact picture, etc)

后端 未结 3 1368
醉梦人生
醉梦人生 2020-12-29 15:56

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

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 16:38

    This solution worked for me with Uri:

    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:"));
    

提交回复
热议问题