title: Adding drawables to an ImageView
body: <p>I am having an issue with Mono for Android and adding drawables as background images or image resources in an <code>ImageView</code>. I have a file in my drawable folder called <code>LogoLarge.png</code>, which I want to display. Its <code>Build Action</code> is set to <code>AndroidResource</code>. So I try this:</p>
  
  <pre><code>&lt;ImageView 
    android:id="@+id/Logo"
    android:src="@drawable/LogoLarge"
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    /&gt;
  </code></pre>
  
  <p>The <code>LogoLarge</code> resource is referenced in <code>Resource.Designer.cs</code>. Building the project works fine. When I try to deploy to the emulator, I get the following in the build output:</p>
  
  <pre><code>C:\Program Files (x86)\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Android" --builddir="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\obj\Debug\android" --framework-dir="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\obj\Debug\res" --package="HelloWorld2.HelloWorld2"   --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_26" --debug --manifest-template="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\Properties\AndroidManifest.xml" --sdk-platform="8" "C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\bin\Debug\HelloWorld2.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll" 
  monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\HelloWorld2.csproj]
      at MonoDroid.Utils.ProcessRocks+&lt;ReadStandardOutput&gt;c__Iterator5.MoveNext () [0x00000] in &lt;filename unknown&gt;:0 
      at Monodroid.Toolbox.InvokeCommand (IEnumerable`1 commandLine) [0x00000] in &lt;filename unknown&gt;:0 
      at Monodroid.Toolbox.InvokeAapt (System.String packageName) [0x00000] in &lt;filename unknown&gt;:0 
      at Monodroid.Droidinator.CreatePackagedResources (System.Collections.Generic.List`1 javaTypes) [0x00000] in &lt;filename unknown&gt;:0 
      at Monodroid.Droidinator.CreateApk () [0x00000] in &lt;filename unknown&gt;:0 
      at Monodroid.MainClass.Main (System.String[] argv) [0x00000] in &lt;filename unknown&gt;:0 
  Done Building Project "C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\HelloWorld2.csproj" (SignAndroidPackage target(s)) -- FAILED.
  </code></pre>
  
  <p>If I remove the <code>android:src</code> property from the XML file, and put this in my <code>Activity1.cs</code> file, it works:</p>
  
  <pre><code>ImageView i = FindViewById&lt;ImageView&gt;(Resource.Id.Logo);
  i.SetImageResource(Resource.Drawable.LogoLarge);
  </code></pre>
  
  <p>The same issue also occurs when trying to set a background image for any view using <code>android:background="@drawable/SomeBackground"</code> in XML, but works fine when doing it programmatically.</p>
  
  <p>What is happening here. Is this a bug in MonoDroid?</p>