6

I would Like to remove the fastforward and rewind buttons from mediacontroller in Android. Can anyone help me with this? I want to do it inside my main activity.

user1479307
  • 83
  • 2
  • 5

2 Answers2

28

When creating a MediaController, make sure to set the boolean to false in the constructor:

MediaController mediaController = new MediaController(this, false);

From the documentation:

The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

Yasha
  • 1,017
  • 11
  • 21
6

If you're trying to remove the buttons from a MediaPlayer than is not part of your app, this is impossible. You cannot mess with other apps' code. Some of them may allow you to pass this as an intent extra while launching them, but the majority probably won't.

If it is part of your app, just comment out the code related to the buttons.

EDIT: From the MediaController documentation:

  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

So all you need to do is pass false in the constructor.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • (http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/MediaController.java.shtml).They are saying that you can by using the MediaController(Context, boolean) constructor with the boolean set to false. – user1479307 Jul 01 '12 at 15:10
  • Well, you have access to the source. Not sure why you'd want to remove a feature, but you can comment the code for those buttons out. – Raghav Sood Jul 01 '12 at 15:12
  • I havent made any buttons. I am using the standard mediacontroller that has the buttons within itself. ` mVideoView = (VideoView) findViewById(R.id.surface_view); MediaController mc = new MediaController(this); mVideoView.setMediaController(mc); ` – user1479307 Jul 01 '12 at 15:18
  • What is the code for that so i should use it in my main activity. – user1479307 Jul 02 '12 at 06:24