通过 android 更改存储在解析中的图像

Change an image that is store in parse through android

我正在尝试通过 android 应用程序更新保存在解析中的图像,我可以检索它并将其加载到应用程序,但我无法保存我创建的新图像选择替换旧的。这就是我尝试这样做的方式,它只保存当前状态的文件而不进行解析。这是我目前拥有的代码,它没有按照我想要的方式工作。请协助。

代码如下

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == LOAD_IMAGE_RESULTS) {
                Uri pickedImage = data.getData();
                InputStream inputStream;
                try {
                    inputStream = getContentResolver().openInputStream(pickedImage);
                    Bitmap selectedImages = BitmapFactory.decodeStream(inputStream);
                    imageSelected.setImageBitmap(selectedImages);

                        selectedImages = ((BitmapDrawable) imageSelected.getDrawable()).getBitmap();
                        ByteArrayOutputStream stream = new ByteArrayOutputStream();
                        selectedImages.compress(Bitmap.CompressFormat.PNG, 5, stream);

                        byte[] imageRec = stream.toByteArray();
                        file = new ParseFile("profileUpdate.png", imageRec);

                        file.saveInBackground(new SaveCallback() {
                            @Override
                            public void done(ParseException e) {
                                if (null == e)
                                    currentUser.put("ProfilePicture", file);
                            }
                        });
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    Toast.makeText(getApplicationContext(),
                            "Unable to load image",
                            Toast.LENGTH_LONG).show();
                }
            }
        }
    }

我刚刚添加了 currentUser.saveInBackground(); currentUser.put("ProfilePicture", file) 之后的行;并添加了一个 currentUser.remove("ProfilePicture");在它之前并且它起作用了。