I have done a simple media player and I would like to ask.. how it be possible to change background image when mediaplayer button is pressed, and when I release the button, background image returns to original. I would like to make image effect when press mediaplayer button.
This is my code i use for mp:
public class MainActivity extends ActionBarActivity {
private MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mp = new MediaPlayer();
}
public void btn1 (View v){
mp.release();
mp = MediaPlayer.create(this, R.raw.est1);
mp.start();
}
@Override
public void onDestroy()
{
if (mp != null) {
mp.release();
mp = null;
}
super.onDestroy();
}
}
0 comments:
Post a Comment