No matter what I try, I cannot set the width and height of my image, which is transferred from the soap service to my Android emulator. I am using ImageView as follows:
byte[] bloc = Base64.decode(result, Base64.DEFAULT); Bitmap bmp = BitmapFactory.decodeByteArray(bloc,0,bloc.length); ImageView image = new ImageView(this); image.setImageBitmap(bmp); image.setLayoutParams( new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); image.getLayoutParams().height = 100; image.getLayoutParams().width = 100; setContentView(image);
In the above code, I am trying to set the width and height manually, jpeg images with a width of 259 pixels and a height of 194 pixels.
The file / res / layout / main.xml looks like
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1" android:id="@+id/llid"> </LinearLayout>
Having tried some of the approaches below, I just see the following on the emulator

I'm not even sure if the approach I am taking is the right one. Most of the other solutions that I found when searching the forums do not work for me. Any suggestions would be great.
source share