0

I am new to android application development.

In my application i play one video file. When i start my activity the video file play properly.

While playing the video ,if i change orientation from landscape to portrait or reverse then the playing video once again stated from beginning.

please help me to go forward.

thank you,

bye.

user1632949
  • 615
  • 3
  • 9
  • 18

3 Answers3

0

Actually what is happening is that, when you are changing the screen orientation, the activity is getting refreshed. You have to stop refreshing the activity on orientation change. For this you can refer:

Don't reload application when orientation changes

Community
  • 1
  • 1
kittu88
  • 2,451
  • 5
  • 40
  • 80
0

Use getLastNonConfigurationInstance() method that prevent to restore the media again.

getLastNonConfigurationInstance()

Md Abdul Gafur
  • 6,213
  • 2
  • 27
  • 37
-1

If you want to continue your video play when change your orientation then

In your manifest file add

<activity android:name=".youractivityname"
              android:label="activity"
              android:configChanges="keyboardHidden|orientation"/>

So that if you change the orientation also then video will be play

Ram kiran Pachigolla
  • 20,897
  • 15
  • 57
  • 78