【问题标题】:Play Android default sound effect播放Android默认音效
【发布时间】:2017-04-07 17:23:23
【问题描述】:

有没有办法以编程方式播放内置音效?我想在我的应用扫描NFC标签时播放NFC音效(成功音效和失败音效)。

【问题讨论】:

    标签: android audio effect


    【解决方案1】:

    我只是从接受的答案中粘贴代码 - StackOverflow question to play Android Notification sound

    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    【讨论】:

    • 如何播放 NFC 音效?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-07
    • 2012-02-12
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多