如何玩默认TICK声音? [英] How to play default TICK sound?

查看:101
本文介绍了如何玩默认TICK声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要连接Android操作系统的默认滴答的声音(例如,你听到当你长按Home键并选择previous app启动的声音)我按一下按钮。我知道如何通过的MediaPlayer播放声音,但我不知道去哪里寻找这个默认滴答声。它必须是在一些默认的资源,但我找不到它。

I want to connect Android OS default tick sound (for example, the sound you hear when you long click Home button and select previous app to start) with my button click. I know how to play sounds via MediaPlayer, but I do not know where to search for this default tick sound. It had to be in some default resources, but I could not find it.

MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound);  
mp.setLooping(false);
mp.start();

任何人都可以帮忙吗?

Anyone can help?

PS。这种声音会的onClick方法内被激活。
PPS。我知道我可以用户/原料目录,但我不认为有必要的。不是说,它的凉爽玩ppared用户的电话本滴答声$ P $。

PS. this sound will be activated inside of onClick method.
PPS. I know I can user /raw dir, but I do not think there's a need for it. Not to say, it's cooler to play this tick sound prepared for user's phone.

推荐答案

我认为你正在寻找的声音,是 - /系统/媒体/音频/ UI /键pressStandard.ogg

I think the sound that you are looking for is and is in - /system/media/audio/ui/KeypressStandard.ogg

我觉得你可以给这条道路的媒体播放器的的setDataSource API。但我真的不知道是否会在所有Android手机相同的名称。

I think you can give that path to the SetDataSource API of the mediaplayer. But I am not really sure if it will have the same name in all android phones.

有可能是一个更好的方式来查询默认的点击声。

There might be a better way to query for default click sound..

注意 - 这是一个pretty的旧的和错误的答案。请检查下面@Roberto Tyley回答。

NOTE - This is a pretty old and wrong answer. Please check @Roberto Tyley answer below.

这篇关于如何玩默认TICK声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆