嘿,我正在制作此应用,用户在其中添加图像附件,然后将其发送到服务器。但是附件不是必需的,因此用户仍可以将其发送到服务器而无需添加附件。如果用户未添加附件,它将发送默认图像。我想从drawable发送图像作为默认图像。我已经编写了代码,但是没有用。我的代码如下:

Resources resources = this.getResources();
        Uri otherPath = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(R.drawable.image) + '/' + resources.getResourceEntryName(R.drawable.eimage));
        String path = otherPath .toString();
        imageFile.setImageBitmap(BitmapFactory.decodeFile(path));

        File file1 = new File(path);
        RequestBody requestBody = RequestBody.create(MediaType.parse("*/*"), file1);
        MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", file1.getName(), requestBody);

它给我错误:“打开失败:ENOENT(没有这样的文件或目录)。 你有什么想法可以使这项工作吗? 对不起,我的英语不好。