Note that there are some explanatory texts on larger screens.

plurals
  1. POplayer stopped when rotated
    primarykey
    data
    text
    <p>I have an application with Media Player.. if auto rotate is disabled my app is working, but if auto rotate is enable my player is stopped.. </p> <p>bellow my script:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pujatrisandya); //requestWindowFeature(Window.FEATURE_NO_TITLE); play = (ImageButton) findViewById(R.id.button2); pause = (ImageButton) findViewById(R.id.button3); stop = (ImageButton) findViewById(R.id.button4); setup(); } public void kembali (View button) {finish();} public void backward (View button) { } public void play (View button) {play ();} public void pause (View button) {pause();} public void stop (View button) {stop ();} public void forward (View button) { } public void onCompletion(MediaPlayer mp) {stop(); } public void onDestroy(){ super.onDestroy(); stop(); } private void play(){ mp.start(); play.setEnabled(false); pause.setEnabled(true); stop.setEnabled(true); } private void pause(){ mp.pause(); play.setEnabled(true); pause.setEnabled(false); stop.setEnabled(true); } private void stop(){ mp.stop(); pause.setEnabled(false); stop.setEnabled(false); try { mp.prepare(); mp.seekTo(0); play.setEnabled(true); } catch (Throwable t) {} } private void setup() { loadClip(); play.setEnabled(true); pause.setEnabled(false); stop.setEnabled(false); } private void loadClip() { mp = MediaPlayer.create(this, R.raw.trisandya); mp.setOnCompletionListener(this); } </code></pre> <p>my question how to player keep playing when screen rotated?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload