Tecnologia do Blogger.
RSS

[androidbrasil-dev] Re: Salvar imagem no formato blob Sqlite

Esqueci de postar o método para ler o bytes

    //Converte o inputStream para byte[]
    public byte[] readBytes(InputStream inputStream) throws IOException {

          ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();

          int bufferSize = 1024;
          byte[] buffer = new byte[bufferSize];

          int len = 0;
          while ((len = inputStream.read(buffer)) != -1) {
            byteBuffer.write(buffer, 0, len);
          }

          return byteBuffer.toByteArray();
    }

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário