mt6735 如何不让收音机和打电话的录音文件在Music APP 的音乐列表中显...
时间:10-02
整理:3721RD
点击:
[Audio APP]如何不让收音机和打电话的录音文件在Music APP 的音乐列表中显示?
[DESCRIPTION]
Music的音乐列表中,会显示所有的音乐文件,其中包括收音机、录音机及电话录音文件,如何不让这些录音文件显示出来?
[SOLUTION]
1、在PhoneRecorder.java文件中addToMediaDB方法中删除如下语句:
if (getPlaylistId() == -1) {
createPlaylist(resolver);
}
int audioId = Integer.valueOf(result.getLastPathSegment());
addToPlaylist(resolver, audioId, getPlaylistId());
2、在FmRecorder.java文件中addCurrentRecordingToDb方法中修改如下
final int size = 8;
ContentValues cv = new ContentValues(size);
//删除以下
cv.put(MediaStore.Audio.Media.IS_MUSIC, 1);
//删除以上
cv.put(MediaStore.Audio.Media.TITLE, title);
cv.put(MediaStore.Audio.Media.DATA, mRecordFile.getAbsolutePath());
final int oneSecond = 1000;
cv.put(MediaStore.Audio.Media.DATE_ADDED, (int) (curTime / oneSecond));
cv.put(MediaStore.Audio.Media.DATE_MODIFIED, (int) (modDate / oneSecond));
cv.put(MediaStore.Audio.Media.MIME_TYPE, RECORDING_FILE_TYPE);
// cv.put(MediaStore.Audio.Media.ARTIST, artist);
cv.put(MediaStore.Audio.Media.ALBUM, RECORDING_FILE_SOURCE);
cv.put(MediaStore.Audio.Media.DURATION, mRecordTime);
int recordingId = addToMediaDB(context, cv);
if (-1 == recordingId) {
// insert failed
return;
}
//删除以下
int playlistId = getPlaylistId(context);
if (-1 == playlistId) {
// play list not exist, create FM Recording play list
playlistId = createPlaylist(context);
}
if (-1 == playlistId) {
// insert playlist failed
return;
}
// insert item to FM recording play list
addToPlaylist(context, playlistId, recordingId);
//删除以上
3、请在TrackBrowserActivity.java文件中的getTrackCursor方法中进行修改:
else if (mPlaylist.equals("recentlyadded")) {
……
where.append(" AND " + MediaStore.MediaColumns.DATE_ADDED + ">");
where.append(System.currentTimeMillis() / 1000 - X);
//添加如下
where.append(" AND " + MediaStore.Audio.Media.IS_MUSIC + "=1");
//添加如上
ret = queryhandler.doQuery(uri,
mCursorCols, where.toString(), null,
/// M: add for chinese sorting
MediaStore.Audio.Media.TITLE_PINYIN_KEY, async);
[DESCRIPTION]
Music的音乐列表中,会显示所有的音乐文件,其中包括收音机、录音机及电话录音文件,如何不让这些录音文件显示出来?
[SOLUTION]
1、在PhoneRecorder.java文件中addToMediaDB方法中删除如下语句:
if (getPlaylistId() == -1) {
createPlaylist(resolver);
}
int audioId = Integer.valueOf(result.getLastPathSegment());
addToPlaylist(resolver, audioId, getPlaylistId());
2、在FmRecorder.java文件中addCurrentRecordingToDb方法中修改如下
final int size = 8;
ContentValues cv = new ContentValues(size);
//删除以下
cv.put(MediaStore.Audio.Media.IS_MUSIC, 1);
//删除以上
cv.put(MediaStore.Audio.Media.TITLE, title);
cv.put(MediaStore.Audio.Media.DATA, mRecordFile.getAbsolutePath());
final int oneSecond = 1000;
cv.put(MediaStore.Audio.Media.DATE_ADDED, (int) (curTime / oneSecond));
cv.put(MediaStore.Audio.Media.DATE_MODIFIED, (int) (modDate / oneSecond));
cv.put(MediaStore.Audio.Media.MIME_TYPE, RECORDING_FILE_TYPE);
// cv.put(MediaStore.Audio.Media.ARTIST, artist);
cv.put(MediaStore.Audio.Media.ALBUM, RECORDING_FILE_SOURCE);
cv.put(MediaStore.Audio.Media.DURATION, mRecordTime);
int recordingId = addToMediaDB(context, cv);
if (-1 == recordingId) {
// insert failed
return;
}
//删除以下
int playlistId = getPlaylistId(context);
if (-1 == playlistId) {
// play list not exist, create FM Recording play list
playlistId = createPlaylist(context);
}
if (-1 == playlistId) {
// insert playlist failed
return;
}
// insert item to FM recording play list
addToPlaylist(context, playlistId, recordingId);
//删除以上
3、请在TrackBrowserActivity.java文件中的getTrackCursor方法中进行修改:
else if (mPlaylist.equals("recentlyadded")) {
……
where.append(" AND " + MediaStore.MediaColumns.DATE_ADDED + ">");
where.append(System.currentTimeMillis() / 1000 - X);
//添加如下
where.append(" AND " + MediaStore.Audio.Media.IS_MUSIC + "=1");
//添加如上
ret = queryhandler.doQuery(uri,
mCursorCols, where.toString(), null,
/// M: add for chinese sorting
MediaStore.Audio.Media.TITLE_PINYIN_KEY, async);