Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. //Tombol Kembali
  2. public boolean onOptionsItemSelected(MenuItem item){
  3. int id = item.getItemId();
  4. mp = MediaPlayer.create(Activity_Surat_Al_Falak.this, R.raw.surat_al_falak);
  5.  
  6. if (id == R.id.suara) {
  7.  
  8. mp.start();
  9.  
  10. item.setEnabled(false);
  11. }else {
  12. Intent myIntent = new Intent(Activity_Surat_Al_Falak.this, Activity_Surat_Pendek.class);
  13. startActivity(myIntent);
  14. finish();
  15. }
  16.  
  17. return super.onOptionsItemSelected(item);
  18. }
  19.  
  20. @Override
  21. protected void onStop() {
  22. super.onStop();
  23.  
  24. if(mp!=null && mp.isPlaying())
  25. {
  26. mp.stop();
  27. mp.release();
  28. mp = null;
  29. }
  30. }
  31. @Override
  32. protected void onDestroy() {
  33. super.onDestroy();
  34. if(mp!=null && mp.isPlaying())
  35. {
  36. mp.stop();
  37. mp.release();
  38. mp = null;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement