There is a Bitmap (Bitmap or its further conversion) object. How can I send it to the server? Himself in the study of advances.

  • Which server? Protocol? - Oleksiy Morenets
  • @ OleksiyMorenets simple server for http protocols in Post request - Fariz Mamedow
  • Put your object in an attribute or parameter and make a post - Oleksiy Morenets
  • @ OleksiyMorenets What should be the type of argument? - Fariz Mamedow
  • public void setAttribute(String name, Object object); - Oleksiy Morenets

1 answer 1

 Bitmap bmp; ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); bmp.recycle(); RequestBody body = createRequestBody("application/octet-stream", byteArray); @POST Call<ResponseBody> post(@Body RequestBody body, @Url String url);