Created
August 26, 2014 17:40
-
-
Save j-onathan/3f775ddf055c61514e89 to your computer and use it in GitHub Desktop.
Android Code Example: ToneGenerator (from https://www.codota.com/android/scenarios/52fcbd00da0abfc92ed33c9c/android.media.ToneGenerator?tag=dragonfly)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100); | |
toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50); | |
if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) { | |
Thread.sleep(100); | |
if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) { | |
Thread.sleep(500); | |
toneGen1.stopTone(); | |
Thread.sleep(100); | |
toneGen2.stopTone(); | |
} else { | |
toneGen1.stopTone(); | |
result = false; | |
} | |
} else { | |
result = false; | |
} | |
toneGen1.release(); | |
toneGen2.release(); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment