title: What is the correct way to extend BrightcovePlayer in Android?
body: <p>I am trying to play a sample video using Brightcove Player. The <a href="http://docs.brightcove.com/en/perform/mobile-sdks/brightcove-player-sdk-for-android/getting-started/brightcoveplayer.html" rel="nofollow">documentation</a> suggests that to implement basic lifecycle callbacks for the player one should extend BrightcovePlayer instead of a simple activity. Here's how I am extending it:</p>
  
  <pre><code>public class BrightCoveActivity extends BrightcovePlayer {
  
  private static final String BC_TOKEN = "&lt;using a valid token here&gt;";
  private String mVideoId;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      setContentView(R.layout.activity_bright_cove);
      final BrightcoveVideoView brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
      super.onCreate(savedInstanceState);
  
      final Catalog catalog = new Catalog(BC_TOKEN);
  
      mVideoId = "&lt;using a valid video ID here";
  
      MediaController controller = new MediaController(this);
      brightcoveVideoView.setMediaController(controller);
  
      catalog.findVideoByID(mVideoId, new VideoListener() {
  
          @Override
          public void onError(String error) {
              throw new RuntimeException(error);
  
          }
  
          @Override
          public void onVideo(Video video) {
              brightcoveVideoView.add(video);
              brightcoveVideoView.start();
          }
      });
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>However I keep getting this <code>IllegalStateException</code> when I try to run the app:</p>
  
  <pre><code>09-09 17:01:51.988: E/AndroidRuntime(21607): Caused by: java.lang.IllegalStateException: brightcoveVideoView needs to be wired up to the layout.
  09-09 17:01:51.988: E/AndroidRuntime(21607):    at com.brightcove.player.view.BrightcovePlayer.onCreate(BrightcovePlayer.java:180)
  </code></pre>
  
  <p>This stack trace eventually points to the <code>super.OnCreate()</code> method. It does not make a difference whether I call the super-class method before or after I "wire up" the BrightcoveVideoView. </p>
  
  <p>I am using:</p>
  
  <ol>
  <li>A <strong>custom layout</strong> with BrightCoveVideoView at this point with no other views except the videoView inside a Relative Layout.</li>
  <li><strong>Eclipse</strong> for development (constrained to do so, can't use Android Studio). I have included the legacy .jar file as a library (the project runs fine if I do this in a simple Activity and not a BrightcovePlayer activity). </li>
  <li><strong>Brightcove SDK 4.5</strong> for Android.</li>
  </ol>