I am trying to create a playlist using the following code
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ContentValues cv = new ContentValues();
cv.put(MediaStore.Audio.Playlists.NAME, "123456");
//Uri uri = getContentResolver().insert(MediaStore.Audio.Playlists.getContentUri("external"), cv);
Uri uri = getContentResolver().insert(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, cv);
if (uri != null)
{
Toast.makeText(getApplicationContext(),uri.toString(),
Toast.LENGTH_LONG).show();
}
}
this just would not create any playlist
if i try INTERNAL_CONTENT_URI the playlist is created but even the default app for music in my phone would not show new playlist created
答案 0 :(得分:0)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
是真正的问题。