I have image's sd card path. Now what are the next steps to convert image into byte array because I want to upload the image to server?
Thanks in advance.
public static byte[] toByteArray (Bitmap raw) {
byte[] byteArray = null;
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream ();
raw.compress (Bitmap.CompressFormat.JPEG, 100, stream);
byteArray = stream.toByteArray ();
}
catch (Exception e) {
e.printStackTrace ();
}
return byteArray;
}