android - 如何在 Android 中以编程方式打开内置均衡器?

标签 android equalizer

我看到许多应用程序在内置均衡器中打开系统(谷歌播放音乐、Spotify、三星音乐播放器)。直接使用,无需自己从头编写。这些应用程序如何做到这一点?我找不到解决方案。

} else if (id == R.id.action_fx) {
        Intent intent = new Intent();
        intent.setAction("android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL");
        if ((intent.resolveActivity(getPackageManager()) != null)) {
            startActivity(intent);
        } else {
            Intent intent11 = new Intent(MainActivity.this, Help.class);
            intent11.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(intent11);
            // No equalizer found :(
        }
        return true;

最佳答案

以下应该可以启动默认均衡器 Activity:

Intent intent = new Intent(AudioEffect
    .ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);

if ((intent.resolveActivity(getPackageManager()) != null)) {
    startActivityForResult(intent, REQUEST_EQ);
} else {
    // No equalizer found :(
}

Spotify 基本上是一样的,其他的没查过。

startActivityForResult() 的必要性在 docs 中有解释。 :

The intent carries a number of extras used by the player application to communicate necessary pieces of information to the control panel application.

The calling application must use the android.app.Activity#startActivityForResult(Intent, int) method to launch the control panel so that its package name is indicated and used by the control panel application to keep track of changes for this particular application.

关于android - 如何在 Android 中以编程方式打开内置均衡器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37774660/

相关文章:

android - 在 Nexus 7 android 的 android webview 中播放内部存储中的 .SWF 文件

iphone - 是否有适用于iOS的实时线性相位均衡器?

ios - AVPlayer播放音频时如何添加iPod EQ?

java - TextView 在相对布局中不显示全文

c++ - 使用FFmpeg或OpenAL的音频均衡器

android - HTTPS Elastic Beanstalk (AWS) 到 Android

android - 如何使用通用图像加载器离线缓存?

android - DDMS 不显示设备名称

android - 如何知道Web服务在android中得到更新

android - 如何规范化android中的视频(mp4)文件?