I need some advice about the code below. I'm trying to create a simple apps that when people click play button, then the music will start playing, and when people click the stop button, the music will stop playing. I'm using a single button for this two task start and stop.

I already test on android simulator, this start and stop button are working properly as I wanted to. But the problem occurred when I build an APK file and play it on a device. The stop button cannot work as I wanted to. If I press the stop button, the music will restart the playing from the beginning.

Any ideas about this problem? Thank you. 

```
btn_playstop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (btn_playstop.isPressed()) {
                if (player.isPlaying()) {
                    player.stop();
                    try {
                        player.prepare();
                    } catch (IllegalStateException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    player.seekTo(0);
                    btn_playstop.setBackgroundResource(R.drawable.play);
                }
                else {
                    player.start();
                    btn_playstop.setBackgroundResource(R.drawable.stop);
                }
            }
        }
    });

```