0
In my application, I have the need to capture an image that is on a basis SQLite
in format byte
(Blob) and then convert it to Bitmap
in order to display it in a ImageView
.
My problem is that the space of ImageView
that remains horizontal is always with black background.
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?
Hello. Could you please edit your question with an image of how your
ImageView
is, the code of how you are doing this conversion and also the layout (.xml) in which yourImageView
is?– rsicarelli