在做项目时候碰到一个录音排序的问题,平台默认的是把最新的文件排在最下面,操作起来很不文件
经看代码发现,修改也不复杂。
修改文件:packages/apps/SoundRecorder/src/com/sprd/soundrecorder/RecordingFileList.java
private ArrayList<RecorderItem> query() { final int INIT_SIZE = 10; ArrayList<RecorderItem> result = new ArrayList<RecorderItem>(INIT_SIZE); Cursor cur = null; try { StringBuilder where = new StringBuilder(); ++++String orderBy = RecorderItem._ID + " " + "DESC";//ASC Yang Liu for recordList order on 2014-12-29 where.append(MediaStore.Audio.Media.COMPOSER) .append("='") .append(SoundRecorder.COMPOSER) .append("'"); cur = RecordingFileList.this.getContentResolver().query( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[] { RecorderItem._ID, RecorderItem._DATA, RecorderItem.SIZE, RecorderItem.TITLE, RecorderItem.DISPLAY_NAME, RecorderItem.MOD_DATE, RecorderItem.MIME_TYPE, RecorderItem.DU_STRING}, ++++where.toString(), null, orderBy);//ASC Yang Liu for recordList order on 2014-12-29带++++的地方是修改的地方,希望能帮点小忙
原文地址:http://blog.csdn.net/silence_cdsn/article/details/42240391