【问题标题】:Does new Google Music Beta support end user selection of songs via intents新的 Google Music Beta 是否支持最终用户通过意图选择歌曲
【发布时间】:2011-05-26 14:56:12
【问题描述】:

我有一个应用程序,它使用ACTION_PICK 允许用户选择一首歌曲。选择该歌曲后,应用程序将使用光标位置并稍后执行另一个意图以显示NOW_PLAYING 界面。该应用程序运行良好,直到我在我的 droid 设备上安装了 Music Beta。然后应用程序开始以UnsupportedOperationException 失败。意图和过滤器如下所示:

Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("vnd.android.cursor.dir/track");
this.startActivity(intent);

我卸载了 Music Bata,该应用程序再次运行良好。想看看这是否是与新的 Google 音乐应用程序相关的错误,看看是否有其他人遇到此问题。

【问题讨论】:

    标签: android google-music


    【解决方案1】:

    检查MusicUtils.java。那里有一些选择歌曲的电话。他们都有:

    intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
    

    another place我发现:

    if (id == RECENTLY_ADDED_PLAYLIST) {
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
        intent.putExtra("playlist", "recentlyadded");
        startActivity(intent);
    } else if (id == PODCASTS_PLAYLIST) {
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
        intent.putExtra("playlist", "podcasts");
        startActivity(intent);
    } else {
        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
        intent.putExtra("playlist", Long.valueOf(id).toString());
        startActivity(intent);
    }
    

    在这两个文件中,Intent 都使用 Uri.EMPTY 进行路由

    【讨论】:

    • 谢谢卡门。我使用空的 Uri 更改了我的代码,重新安装了音乐 bata 并测试了该应用程序。它以相同的错误代码失败:05-27 08:44:19.882: ERROR/AndroidRuntime(17762): FATAL EXCEPTION: main 05-27 08:44:19.882: ERROR/AndroidRuntime(17762): android.content.ActivityNotFoundException: No发现活动处理 Intent { act=android.intent.action.PICK dat= typ=vnd.android.cursor.dir/track } 05-27 08:44:19.882: ERROR/AndroidRuntime(17762): at android.app。 Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
    • 异常的日志是什么?
    • 那是日志的一部分,由于某种原因我无法在此处发布整个日志...字符空间不足....05-27 08:44:19.882: ERROR/ AndroidRuntime(17762): 致命异常: main 05-27 08:44:19.882: ERROR/AndroidRuntime(17762): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK dat= typ =vnd.android.cursor.dir/track } 05-27 08:44:19.882: 错误/AndroidRuntime(17762): 在 android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
    • 似乎不太好 :) 这似乎确实是由 Music Beta 引起的。你最好尝试联系音乐团队。对不起...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-06
    • 1970-01-01
    • 2016-07-25
    • 2020-06-20
    • 2019-08-20
    相关资源
    最近更新 更多