I request your support in resolving the problem I currently faced with the 
following coding - trying to upload the image on server using Parse API.

I can read from the server and update data on any column except uploading 
image.


TI have picked the image from the device and displayed in imageView..

// Move to first row

 

                         cursor.moveToFirst();

 

                         int columnIndex = 
cursor.getColumnIndex(filePathColumn[0]);

 

                         String imgDecodableString = 
cursor.getString(columnIndex);

 

                         cursor.close();

 

                         ImageView imageView = (ImageView) 
findViewById(R.id.imageView);

 

                        Bitmap bitmap = ((BitmapDrawable) 
imageView.getDrawable()).getBitmap();

   

 

                      // Set the Image in ImageView after decoding the 
String

                      

 

                         

                         imageView.setImageURI(selectedImage);

                         
Picasso.with(this).load(selectedImage).fit().centerCrop().into(imageView);

 

                      //resizing the image part 2

                       ByteArrayOutputStream baos = new 
ByteArrayOutputStream();

 

                       //to Compress the image

                       //Quality Accepts 0 - 100

                       //0 = MAX Compression (Least Quality which is 
suitable for Small images)

                       //100 = Least Compression (MAX Quality which is 
suitable for Big images)

                       bitmap.compress(Bitmap.CompressFormat.PNG, 0, baos);

 

                       //uploading the image to server

                       byte[] imageInByte = imgDecodableString.getBytes();

 

                       final ParseFile bitmapFile = new 
ParseFile(imageInByte);

 

                       bitmapFile.saveInBackground();

 

                       //current user is already logged in.


                       ParseObject userDisplayImage = new 
ParseObject("UserDisplayImage");

                       userDisplayImage.put("photo", bitmapFile);

                       userDisplayImage.saveInBackground();


Waiting your response.

MAT


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fe09cf4d-de59-4d92-99b1-09248525a9b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to