Skip to content Skip to sidebar Skip to footer

How To Update Image Using Parse Android?

I want to fetch image from table 1 to update image in table 2 on parse here is my code ParseFile image= ParseUser.getCurrentUser().getParseFile('image'); if(image==null)

Solution 1:

You need ParseFile object. Try the following code. (It works fine, I just checked it)

byte[] pfArray = getBytesFromBitmap(bmp);
                ParseFilefile=newParseFile("abc.png", pfArray);
                // Upload the image into Parse Cloud
                file.saveInBackground(newSaveCallback() {

                    @Overridepublicvoiddone(ParseException e) {
                        System.out.println("saved");

                    }
                });

publicbyte[] getBytesFromBitmap(Bitmap bitmap) {
        ByteArrayOutputStreamstream=newByteArrayOutputStream();
        bitmap.compress(CompressFormat.PNG, 70, stream);
        return stream.toByteArray();
    }

hope it helps.

Post a Comment for "How To Update Image Using Parse Android?"