2010-07-05 60 views
9

是否有可以通過編程方式調用的Android歌曲選擇器?適用於Android的歌曲選擇器

我正在尋找類似於iPhone的MPMediaPickerController,它顯示了用戶可以從哪裏選擇歌曲的視圖。

+0

Mayebe這個東西給你:http://code.google.com/p/eyes-free/source/browse /trunk/RockLock/src/com/marvin/rocklock/SongPicker.java?r=609 – RoflcoptrException 2010-07-05 13:39:55

回答

15

您可以發送「ACTION_PICK」或「ACTION_GET_CONTENT」類型的意圖。例如:

Intent i = new Intent(Intent.ACTION_GET_CONTENT); 
    i.setType("audio/*"); 
    Intent c = Intent.createChooser(i, "Select soundfile"); 
    startActivityForResult(c,1); 

在這裏看到更多的信息:

http://developer.android.com/reference/android/content/Intent.html#ACTION_GET_CONTENT

+2

請注意,並非每個應用程序都有一個選擇器。我剛剛得到了一項關於在客戶設備上找不到該活動的評論報告。 – schlingel 2012-06-18 10:56:19