title: InflateException in custom ImageView
body: <p>I'm making an example that rotate an image like <a href="https://stackoverflow.com/a/1931825/2212742">this post</a>.<br>
  I've extends ImageView then override the OnDraw and put in MainActivity. But It fired "InflateException".
  Here is my example code:<br>
  MImageView  </p>
  
  <pre><code>public class MImageView extends ImageView {
  
      public MImageView(Context context) {
          super(context);
          // TODO Auto-generated constructor stub
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          // TODO Auto-generated method stub
          canvas.save();
          canvas.rotate(45, 0, 0);
          super.onDraw(canvas);
          canvas.restore();
      }
  }
  </code></pre>
  
  <p>MainActivity  </p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          MImageView mImageView = (MImageView) findViewById(R.id.imageView1);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>main_activity.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
  
  
      &lt;com.example.rotatetest.MImageView
          android:id="@+id/imageView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/ic_launcher" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Manifest</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.rotatetest"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.rotatetest.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Logcat</p>
  
  <pre><code>08-16 10:21:31.820: D/AndroidRuntime(5135): Shutting down VM
  08-16 10:21:31.820: W/dalvikvm(5135): threadid=1: thread exiting with uncaught exception (group=0x40ab4210)
  08-16 10:21:31.820: E/AndroidRuntime(5135): FATAL EXCEPTION: main
  08-16 10:21:31.820: E/AndroidRuntime(5135): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rotatetest/com.example.rotatetest.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.example.rotatetest.MImageView
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread.access$600(ActivityThread.java:134)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.os.Looper.loop(Looper.java:137)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread.main(ActivityThread.java:4697)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at java.lang.reflect.Method.invoke(Method.java:511)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at dalvik.system.NativeStart.main(Native Method)
  08-16 10:21:31.820: E/AndroidRuntime(5135): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class com.example.rotatetest.MImageView
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.createView(LayoutInflater.java:589)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:255)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.Activity.setContentView(Activity.java:1879)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at com.example.rotatetest.MainActivity.onCreate(MainActivity.java:15)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.Activity.performCreate(Activity.java:4539)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2013)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     ... 11 more
  08-16 10:21:31.820: E/AndroidRuntime(5135): Caused by: java.lang.NoSuchMethodException: &lt;init&gt; [class android.content.Context, interface android.util.AttributeSet]
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at java.lang.Class.getConstructorOrMethod(Class.java:460)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at java.lang.Class.getConstructor(Class.java:431)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     at android.view.LayoutInflater.createView(LayoutInflater.java:561)
  08-16 10:21:31.820: E/AndroidRuntime(5135):     ... 22 more
  </code></pre>
  
  <p>Did I do something wrong?</p>