Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2. if (!cond1 ) {
  3.  
  4. b1.setOnClickListener(new View.OnClickListener() {
  5. @Override
  6. public void onClick(View v) {
  7.  
  8. audio_buongiorno.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
  9.  
  10. @Override
  11. public void onCompletion(MediaPlayer mp) {
  12. b1.setBackgroundResource(android.R.drawable.btn_default);
  13. b1.setText("Buongiorno Buonasera");
  14. Log.v("cond","cond 1 stop "+cond1);
  15. cond1 = false;
  16.  
  17. }
  18.  
  19. });
  20. audio_buongiorno.start();
  21.  
  22. b1.setBackgroundColor(Color.RED);
  23. b1.setText("Riproduzione in corso . . .");
  24. cond1 = true;
  25.  
  26. Log.v("cond", "cond 1 " + cond1);
  27. }
  28.  
  29. });
  30.  
  31. }
  32.  
  33. if(cond1) {
  34. b1.setOnClickListener(new View.OnClickListener() {
  35. @Override
  36. public void onClick(View v) {
  37. audio_buongiorno.stop();
  38. b1.setBackgroundResource(android.R.drawable.btn_default);
  39. b1.setText("Buongiorno Buonasera");
  40.  
  41. cond1 = false;
  42. Log.v("cond", "cond 2 " + cond1);
  43. }
  44. });
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement