Hello,

I am trying to keep a video playback going after a orientation change
but keep getting a crash when trying to pass the media player trough
onRetainNonConfigurationInstance.

I can pass the time, setup the media player from scratch and do a fast
forward but I would not like to do the setup more than once.

My code looks like:

@Override
public Object onRetainNonConfigurationInstance() {
                 return(  mp  );
 }

public void onCreate(Bundle icicle) {
                ...
                createMediaPlayer();
}

public void createMediaPlayer() {
                ...
                if (getLastNonConfigurationInstance()!=null) {
                mp  = (MediaPlayer) getLastNonConfigurationInstance() ;
                } else {
                        mp = new MediaPlayer();
                        ...
                }
}

Can anyone help me pinpoint why this does not work?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to