Transforming image into an array of bytes

Asked

Viewed 32 times

0

ImageView imgProduto = (ImageView) findViewById(R.id.imgProduto);

Bitmap bitmap = ((BitmapDrawable)imgProduto.getDrawable()).getBitmap();
                ByteArrayOutputStream saida = new ByteArrayOutputStream();
                bitmap.compress(Bitmap.CompressFormat.PNG,100,saida);
                final byte[] img = saida.toByteArray();
                produto.setFoto(img);
  • What is the doubt?

  • I used this code to convert an image into an array of bytes but sending it to the database by the product.setFoto(img) did not save

  • Which bank are you using? Is it local or remote? Are you using a ORM for bank access?

  • I am using MYSQL Local with a Web Service REST in Java

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.