title: MonoDroid: Error when calling constructor of custom view - TwoDScrollView
body: <p>I am building an Android application that uses the custom-built TwoDScrollView found here:</p>
  
  <p><a href="http://blog.gorges.us/2010/06/android-two-dimensional-scrollview/">http://blog.gorges.us/2010/06/android-two-dimensional-scrollview/</a></p>
  
  <p>This same class can be found referenced at several other websites, and others on Stack Overflow have asked questions with regard to it.  I was using it in a previous Android application that I was building using Java/Eclipse, and I was having success.</p>
  
  <p>With my current application, I wanted to use C# and MonoDroid.  I decided to rewrite the entire TwoDScrollView class in C#.  After rewriting it, and then using it in some layout XML, I get the following exceptions when trying to run my code:</p>
  
  <blockquote>
    <p>System.NotSupportedException has been thrown.  Unable to activate
    instance of type MyProject.TwoDScrollView from native handle 44f4d310.</p>
    
    <p>System.Exception: No constructor found for
    MyProject.TwoDScrollView::.ctor(System.IntPtr,
    Android.Runtime.JniHandleOwnership) ......with more text that
    follows....</p>
  </blockquote>
  
  <p>My layout XML is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
  
  &lt;myproject.TwoDScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
  &lt;/myproject.TwoDScrollView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Per the instructions at the following link on using custom views in layout XML in MonoDroid:  <a href="http://docs.xamarin.com/android/advanced_topics/using_custom_views_in_a_layout">http://docs.xamarin.com/android/advanced_topics/using_custom_views_in_a_layout</a></p>
  
  <p>The constructors to the TwoDScrollView class look as follows:</p>
  
  <pre><code>public TwoDScrollView(Context context) 
      : base(context)
  {
      initTwoDScrollView();
  }
  
  public TwoDScrollView(Context context, IAttributeSet attrs) 
      : base(context, attrs)
  {
      initTwoDScrollView();
  }
  
  public TwoDScrollView(Context context, IAttributeSet attrs, int defStyle) 
      : base(context, attrs, defStyle)
  {
      initTwoDScrollView();
  }
  </code></pre>
  
  <p>The same constructors exist in the C# version as in the Java version (which you can find at the above link).  Any idea on what could be going wrong?  I can post the full C# code of my TwoDScrollView if anyone would like to see it.  It's essentially the same as the Java code bit for bit - except rewritten in C#.</p>
  
  <p>Thanks for any help!</p>