-1

How can I save playing media state when the window rotating by user ?

Saeed Hashemi
  • 984
  • 4
  • 22
  • 55

2 Answers2

2

With onSaveInstanteState, like you always do for Saving Android Activity state using Save Instance State

This also means that you need to keep track of the MediaPlayerService state yourself, since there is no way to get the state of the media player.

Community
  • 1
  • 1
rds
  • 26,253
  • 19
  • 107
  • 134
1

You may follow this link in order to stop refreshing the activity on orientation change:

Activity restart on rotation Android

Community
  • 1
  • 1
kittu88
  • 2,451
  • 5
  • 40
  • 80
  • There are many answers to this question. If you are referring to `android:configChanges`, this goes against the philosophy of the framework, and I would not recommend this option. From the [Android dev guide](http://developer.android.com/guide/topics/manifest/activity-element.html#config): *Using this attribute should be avoided and used only as a last-resort. Please read [Handling Runtime Changes](http://developer.android.com/guide/topics/resources/runtime-changes.html) for more information about how to properly handle a restart due to a configuration change.* – rds Oct 15 '12 at 10:49