在我的应用程序中实现设置为图片按钮

implement set as picture button in my app

我使用 json 显示来自网络服务的图像。现在如何为用户提供图像作为 whatsapp 或联系人照片等的个人资料图片,如何调用该意图打开设置图片为 -> 设置为 -> 显示多个选项 -> 联系人照片墙纸,whatsapp 个人资料照片等, ?

 Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
 intent.setDataAndType(Uri.parse(filename.getAbsolutePath()), "image/*");
 intent.putExtra("jpg", "image/*");
 startActivity(Intent.createChooser(intent, ("set as")));

使用此代码。

File externalFile=new File("filePath")    
Uri sendUri = Uri.fromFile(externalFile)
        Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
                intent.setDataAndType(sendUri, "image/jpg");
                intent.putExtra("mimeType", "image/jpg");
                startActivityForResult(Intent.createChooser(intent, "Set As"), 200);