2014-01-28 27 views

回答

0
Drawable d = context.getResources().getDrawable(R.drawable.human_head); 
      Bitmap bitmap = ((BitmapDrawable) d).getBitmap(); 
      ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
      bitmap.compress(Bitmap.CompressFormat.JPEG, 80, stream); 
      byte[] bitmapdata = stream.toByteArray(); 
      entity.addPart("image", new ByteArrayBody(bitmapdata,".png")); 


    httpPost.setEntity(entity); 
     HttpResponse response = httpClient.execute(httpPost, WebService.getInstance(Constants.WEB_SERVER).getLocalContext()); 
相關問題