Android getContentResolver().insert(…;,…;);为通知铃声返回NULL
getContentResolver()。插入(…,…);在设备的BootCompleted上调用setRingtone函数时,为通知铃声返回NULL,否则工作正常: 以下是设置铃声的方法代码:Android getContentResolver().insert(…;,…;);为通知铃声返回NULL,android,Android,getContentResolver()。插入(…,…);在设备的BootCompleted上调用setRingtone函数时,为通知铃声返回NULL,否则工作正常: 以下是设置铃声的方法代码: File file = new File(path, filename); ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, file.getAbsolutePath()); valu
File file = new File(path, filename);
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, file.getAbsolutePath());
values.put(MediaStore.MediaColumns.TITLE, "Tone");
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/ogg");
values.put(MediaStore.Audio.Media.ARTIST, "test");
values.put(MediaStore.Audio.Media.IS_RINGTONE, false);
values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
values.put(MediaStore.Audio.Media.IS_ALARM, false);
values.put(MediaStore.Audio.Media.IS_MUSIC, false);
Uri u = getContentResolver().insert(
MediaStore.Audio.Media.getContentUriForPath(file.getAbsolutePath()), values);
logcat中是否显示任何内容?也许是一个SqliteException?