I want to send a Bitmap to Server  and I want to use Socket .....

This is my code  in the Class Client::: This code save the Bitmap
compressed in Jpeg in the phone , after I want send it.

                ContentValues values = new ContentValues(3);
                values.put(MediaStore.Images.Media.DISPLAY_NAME,"Esempio");
                values.put(MediaStore.Images.Media.DESCRIPTION, "Esempio");
                values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");

                // Add a new record without the bitmap, but with the values.
                // It returns the URI of the new record.
                Uri uri = getContentResolver().insert
(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

                try {
                    Bitmap sourceBitmap=BitmapFactory.decodeByteArray(img, 0,
img.length);
                    // Now get a handle to the file for that record, and save 
the
data into it.
                    // sourceBitmap is a Bitmap object representing the file to 
save
to the database.
                    OutputStream outStream = 
getContentResolver().openOutputStream
(uri);
                    sourceBitmap.compress(Bitmap.CompressFormat.JPEG, 50,
outStream);
                    outStream.close();

                } catch (Exception e) {
                    Log.e(TAG, "exception while writing image", e);
                }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to