title: Custom view in xml layout not working
body: <p>I'm trying to add a subclass of View to my activity_main.xml  like <a href="https://stackoverflow.com/questions/3260876/custom-view-in-xml-layout">this</a>.</p>
  
  <p>However, the device and emulator drop out of the app straight away.  The error appears to be Error inflating class com.example.androidtest.PuzzleView</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;com.example.androidtestapp.PuzzleView
      android:id="@+id/puzzleView"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="60"/&gt;
  
  &lt;include
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="40"
      layout="@layout/activity_input"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>package com.example.androidtestapp;
  
  
  public class PuzzleView extends View {
  
  
  public PuzzleView(Context context) {
      super(context);
      setFocusable(true);
      setFocusableInTouchMode(true);
  
  
  }
  }
  </code></pre>