In my application, I need to capture an image that is on a SQLite
base in the byte
(Blob) format and then convert it to Bitmap
to display it in a ImageView
.
My problem is that the space of ImageView
that is left horizontal is always black.
layout.xml
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView1"
android:layout_weight="1"
android:src="@drawable/foto_default" />
</LinearLayout>
Conversion Method:
private void setImage(){
byte[] outImage = lista.get(position).getFoto();
ByteArrayInputStream imageStream = new ByteArrayInputStream(outImage);
Bitmap imagemConvertida = BitmapFactory.decodeStream(imageStream);
foto.setImageBitmap(imagemConvertida);
}
Can you help me?