how to send image to remote server using web services in android

Posted by Aswan on Stack Overflow See other posts from Stack Overflow or by Aswan
Published on 2010-04-14T13:10:57Z Indexed on 2010/04/14 13:13 UTC
Read the original article Hit count: 207

Filed under:

get image from sdcard and store that image to remote server. i am getting the image from sdcard and i converterd that image to bytearray by using bitmap .but what's the problem if i oberver byte array it is showing some different values it is not matching with .net image byte array conversion. can u pl help if you have any solution it is very urgent to me

following is the code i am using can u pl suggest me

FileInputStream fin = new FileInputStream(new File("/sdcard/pictures/1.jpg"));
BufferedInputStream bis = new BufferedInputStream(fin,3000);
byte[] data = new byte[bis.available()];
bis.read(data, 0, data.length);
byte[] data1=new byte[data.length];
for (int i = 0; i < data.length; i++)
{
System.out.print(data[i]);
data1[i]=data[i];
}
System.out.println("5..................."+data1);
Bitmap bitmap = BitmapFactory.decodeByteArray(data1,0,data1.length);
System.out.println("6..................."+data1.length);
Log.v("hgfjohfjghjdfhgj",""+bitmap);
if(bitmap!=null)
image.setImageBitmap(bitmap);
else
Log.e("Bitmap "," Not Created");

© Stack Overflow or respective owner

Related posts about android