androidmediacontroller

FragmentActivity.getSupportMediaController() is deprecated


For getting a MediaControllerCompat instance I'm using getSupportMediaController() in FragmentActivity. But this method is deprecated. Which method do I have to use instead of this method?


Solution

  • Just check the Android official docs .. https://developer.android.com/reference/android/support/v4/app/FragmentActivity.html

    It tells you everything.

    According to Android Developer documentation :

    This method is deprecated.Use getMediaController() instead. This API will be removed in a future release.

    So you have to use getMediaController() instead of getSupportMediaController()

    To support devices older than SDK level 21 use MediaControllerCompat.getMediaController(activity)