title: Abstract Views for API level
body: <p>So currently I have a view</p>
  
  <pre><code>            &lt;TextureView
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:id="@+id/texture_view"
                  android:visibility="gone" /&gt;
  </code></pre>
  
  <p>Which only supports Android API 14 and up ... I want to create a different view for API &lt; 14 ... So I want create an abstract view and call it in the XML layout file </p>
  
  <pre><code>            &lt;CustomView
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:id="@+id/texture_view"
                  android:visibility="gone" /&gt;
  </code></pre>
  
  <p>Is it possible in code to do the following</p>
  
  <pre><code>CustomView v;
  
  if (DeviceVersion.atLeast(API_14)) {
         v = (TextureView) root.findViewById(R.id.texture_view);
   }
   else {
        v = (SurfaceView) root.findViewById(R.id.texture_view);
   }
  </code></pre>
  
  <p>Where CustomView is part of both Surface and Texture ... or Do i need to make two different View say CustomSurface and CustomTexture that implement CustomView ?</p>
  
  <p>If there is a better way to get around this API view issue, please let me know also</p>