title: MediaController - Error when Show() called
body: <p>I have this code for show the MediaController, but it give me a fatal error when I'm calling to Show() method.</p>
  
  <p>The MediaPlayer itself working on Service and get Intent from the MediaPlayerControl interface.</p>
  
  <p>My code:</p>
  
  <pre><code>    @Override
      protected void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
              mediaController =  new MediaController(this, false);
              mediaController.setMediaPlayer(mediaPlayerControl);
              mediaController.setAnchorView(findViewById(R.id.mediaController));
              mediaController.setEnabled(true);
              mediaController.show(0);
      }
  
      //implements MediaPlayerControl interface
      private MediaPlayerControl mediaPlayerControl = new MediaPlayerControl()
      {
  
              //Override the methods to send Intent to the MediaPlayer Service
              ....
              ....
       };
  </code></pre>
  
  <p>my logcat:</p>
  
  <blockquote>
    <p>07-27 11:03:07.365: E/AndroidRuntime(328): FATAL EXCEPTION: main
    07-27 11:03:07.365: E/AndroidRuntime(328): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.radius100fm/com.example.radius100fm.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.os.Handler.dispatchMessage(Handler.java:99)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.os.Looper.loop(Looper.java:123)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread.main(ActivityThread.java:3683)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at java.lang.reflect.Method.invokeNative(Native Method)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at java.lang.reflect.Method.invoke(Method.java:507)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at dalvik.system.NativeStart.main(Native Method)
    07-27 11:03:07.365: E/AndroidRuntime(328): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.view.ViewRoot.setView(ViewRoot.java:527)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.view.Window$LocalWindowManager.addView(Window.java:424)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.widget.MediaController.show(MediaController.java:304)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at com.example.radius100fm.MainActivity.onCreate(MainActivity.java:100)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    07-27 11:03:07.365: E/AndroidRuntime(328):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    07-27 11:03:07.365: E/AndroidRuntime(328):  ... 11 more</p>
  </blockquote>
  
  <p>What is the problem with my code?</p>