Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将图像发送到gallery以设置壁纸?_Android_Android Intent_Android Gallery - Fatal编程技术网

Android 如何将图像发送到gallery以设置壁纸?

Android 如何将图像发送到gallery以设置壁纸?,android,android-intent,android-gallery,Android,Android Intent,Android Gallery,我试图使用默认的gallery应用程序集成设置为壁纸选项,我不知道如何使用intent将图像发送到gallery。我附上fb应用程序的样本,看看它是什么样子 问题是图像没有传递到库中。我可以将内部文件用于Uri.fromFile()吗? Intent emailIntent = new Intent(Intent.ACTION_ATTACH_DATA); emailIntent.setDataAndType(Uri.fromFile(f

我试图使用默认的gallery应用程序集成设置为壁纸选项,我不知道如何使用intent将图像发送到gallery。我附上fb应用程序的样本,看看它是什么样子


问题是图像没有传递到库中。

我可以将内部文件用于Uri.fromFile()吗?
     Intent emailIntent = new Intent(Intent.ACTION_ATTACH_DATA);
                        emailIntent.setDataAndType(Uri.fromFile(fileForImage), "image/*");
                        //emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(fileForImage));
                        startActivity(emailIntent);
                        Toast.makeText(getApplicationContext(), "Image is saved to "+Constants1.APPNAME+" folder", Toast.LENGTH_SHORT).show();
     Intent emailIntent = new Intent(Intent.ACTION_ATTACH_DATA);
                        emailIntent.setDataAndType(Uri.fromFile(fileForImage), "image/*");
                        //emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(fileForImage));
                        startActivity(emailIntent);
                        Toast.makeText(getApplicationContext(), "Image is saved to "+Constants1.APPNAME+" folder", Toast.LENGTH_SHORT).show();