that_person

Android Example: ToneGenerator (via http://goo.gl/5t2s2e)

Aug 26th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
  2. toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50);
  3.  
  4. if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) {
  5.         Thread.sleep(100);
  6.         if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) {
  7.             Thread.sleep(500);
  8.             toneGen1.stopTone();
  9.             Thread.sleep(100);
  10.             toneGen2.stopTone();
  11.         } else {
  12.             toneGen1.stopTone();
  13.             result = false;
  14.         }
  15.     } else {
  16.         result = false;
  17.     }
  18.  
  19.     toneGen1.release();
  20.     toneGen2.release();
  21.     return result;
  22. }
Add Comment
Please, Sign In to add comment