title: Custom component inflates in App but not in Widget
body: <h1>Background</h1>
  <p>I created a custom component to draw on top of an image. At this stage I am merely extending the view.</p>
  <p>My primary intention was to create a Widget but could not get it to work. I tried to load the same component in a main Activity, it worked <kbd>Face Palm</kbd>.</p>
  <p>To be clear I read <a href="https://stackoverflow.com/questions/12872848/android-view-inflateexception-binary-xml-file-line-when-using-custom-view">many</a> <a href="https://stackoverflow.com/questions/21857260/inflateexception-with-custom-view">many</a> <a href="https://stackoverflow.com/questions/47933997/android-error-when-inflating-custom-view-in-xml">many</a> <a href="https://stackoverflow.com/questions/22432901/android-view-inflateexception-issues-creating-custom-view">many</a> ... <a href="https://static0.thequizimages.com/wordpress/wp-content/uploads/2018/02/10-boring1.jpg" rel="nofollow noreferrer">many</a> post on this topic. This is not a constructor issue.</p>
  <h1>Symptom</h1>
  <p>When I load the component in a Widget, I get the following InflateException (no stacktrace).</p>
  <pre><code>2020-06-20 09:23:56.368 2602-2602/? W/AppWidgetHostView: Error inflating AppWidget AppWidgetProviderInfo(UserHandle{0}/ComponentInfo{com.package/com.package.WidgetProvider}): android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.package.MyView
  </code></pre>
  <h1>Code</h1>
  <p>The culprit class</p>
  <pre><code>@RemoteViews.RemoteView
  public class MyView extends ImageView {
  
      public MyView(Context context) {
          this(context, null);
      }
  
      public MyView(Context context, AttributeSet attrs) {
          super(context, attrs);
          init();
      }
  
      private void init() {
          // Eventually we'll do something mystical here
      }
  
  }
  </code></pre>
  <p>Here is the Widget Layout</p>
  <pre><code>&lt;LinearLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
       android:layout_height=&quot;match_parent&quot;
       android:layout_width=&quot;match_parent&quot;&gt;
      &lt;com.package.MyView
          android:id=&quot;@+id/myview&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:src=&quot;@drawable/myimage&quot;
          /&gt;
      
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>Note: if I switch com.package.MyView for ImageView, it works. See below (ImageView vs MyView)
  <a href="https://i.stack.imgur.com/CZD8f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZD8f.png" alt="enter image description here" /></a></p>
  <h1>Question</h1>
  <p>How do I get this component to inflate correctly in the Widget?</p>