Putting Image From Gallery In Parsefile In Android
I am working on a parse.com Android application, in which I am putting my predefined/default image in ParseFile and sending it to the server. Now I want to put an image on user sel
Solution 1:
Try this...
 public void setImage( Bitmap map){
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    // Compress image to lower quality scale 1 - 100
    map.compress(Bitmap.CompressFormat.JPEG, 100, stream);
    byte[] image = stream.toByteArray();
    // Create the ParseFile
    ParseFile file  = new ParseFile("picture_1.jpeg", image);
     // Upload the image into Parse Cloud
    ParseUser user = ParseUser.getCurrentUser();
    user.put("profilePic",file);
user.saveInBackground(new SaveCallback() {
    @Override
    public void done(ParseException e) {
    }
});
}
Post a Comment for "Putting Image From Gallery In Parsefile In Android"