title: MvvmCross Bitmap binding in Android
body: <p><strong>Situation:</strong> I’m using a web service to get the byte[] of an image and then store them in my local database.<br>
  My view model knows when to call the web service and save them to the local database. During this process the view model will update My Image of the <code>byte[]</code>. This process does it's job. But there is a problem in updating My Image on screen. The problem occurs only if I don't change the screen. Scroll-up and down or go back to page solves it. If the <code>byte[]</code> already in localdatabase theres no problem.</p>
  
  <p><strong>Screen: Listitem</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:local="http://schemas.android.com/apk/res-auto"
       android:background="@android:color/white"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:orientation="vertical"&gt;    
       &lt;Mvx.MvxImageView android:id="@+id/ImageViewNewsListItemNews"
                android:layout_width="70dp"
                android:layout_height="70dp"
                local:MvxBind="Bitmap MyImage,Converter=InMemoryImage”/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Convertor:</strong></p>
  
  <pre><code>public class InMemoryImageConverter : MvxValueConverter&lt;byte[],Bitmap&gt;
  {
    protected override Bitmap Convert(byte[] value, Type targetType, object parameter,CultureInfo culture)
      {
           if(value == null || value.length == 0){return null;}
           return BitmapFactory.DecodeByteArray(value, 0, value.Length);
      }
  
      protected override byte[] ConvertBack(Bitmap value, Type targetType, object parameter, CultureInfo culture)
       {
          var stream = new MemoryStream();
          value.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
          return stream.ToArray();
       }
  }
  </code></pre>