0

我有一个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,应用程序再次运行良好。想看看这是否是与新的谷歌音乐应用程序相关的错误,看看其他人是否有这个问题。

4

1 回答 1

0

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

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

另一个地方我发现:

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 路由

于 2011-05-26T15:10:05.647 回答