Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.media.ToneGenerator;

public class Main {
    /** Returns a string character that represents the tone type. if input is
     * invalid, then returns an empty string. */
    public static String getStringFromToneType(int toneType) {
        switch (toneType) {
        case ToneGenerator.TONE_DTMF_0:
            return "0";
        case ToneGenerator.TONE_DTMF_1:
            return "1";
        case ToneGenerator.TONE_DTMF_2:
            return "2";
        case ToneGenerator.TONE_DTMF_3:
            return "3";
        case ToneGenerator.TONE_DTMF_4:
            return "4";
        case ToneGenerator.TONE_DTMF_5:
            return "5";
        case ToneGenerator.TONE_DTMF_6:
            return "6";
        case ToneGenerator.TONE_DTMF_7:
            return "7";
        case ToneGenerator.TONE_DTMF_8:
            return "8";
        case ToneGenerator.TONE_DTMF_9:
            return "9";
        case ToneGenerator.TONE_DTMF_A:
            return "A";
        case ToneGenerator.TONE_DTMF_B:
            return "B";
        case ToneGenerator.TONE_DTMF_C:
            return "C";
        case ToneGenerator.TONE_DTMF_D:
            return "D";
        case ToneGenerator.TONE_DTMF_P:
            return "#";
        case ToneGenerator.TONE_DTMF_S:
            return "*";
        default:
            return "";
        }
    }
}