Hi,
I need to send a bitmap to a server. I've written some code, however,
I got stuck on the part where I need to transform my bitmap into byte
[]. Here is my code:
public void updateBitmap(Bitmap bm){
URL url = null;
HttpURLConnection conn = null;
try {
url = new URL("http://www.myurl.com?");
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
conn = (HttpURLConnection) url.openConnection
();
} catch (IOException e) {
e.printStackTrace();
}
try {
conn.setRequestMethod("POST");
} catch (ProtocolException e) {
e.printStackTrace();
}
conn.setDoOutput(true);
conn.setDoInput(true);
conn.addRequestProperty("user_id", user.getUsername
());
conn.addRequestProperty("pass", user.getPassword());
conn.addRequestProperty("id", pinId);
OutputStream os = null;
try {
os = conn.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
// Encode bitmap and flush the os
}
Could you advice me on how to complete my code? Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---