I am developing an Android app which gets an image encoded in base 64 from a web service, and shows it in an ImageView.
My problem is that the image is showing correctly on the emulator, but when running on the tablet (tablet ASUS Transformer with Android 4) the ImageView seems to disappear when loading it with the image.
This is the code I am using to load the ImageView:
ImageView imageView = (ImageView) this.findViewById(R.id.floor_map_view);
Bitmap image = BitmapFactory.decodeByteArray(result, 0, result.length);
imageView.setImageBitmap(image);
The image is obtained correctly from the web service, as I said it is loading correctly on the emulator and plus I've compared the base 64 string received to that sent from my web service and they match.
This is my activity layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffff">
<ImageView
android:contentDescription="floorMapView"
android:id="@+id/floor_map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#222222"
/>
</LinearLayout>
Any ideas what might be happening?
Thank you.
edit: using inSampleSize in an BitmapFactory.Options object and using it in the decodeByteArray call makes the image appear, but, as expected, smaller than it should be.