Sortierreihenfolge in der Android-Liste von Mediastore

ich brauche einVideogalerie auf Android nach den neuesten sortiert. Mit dem folgenden Code wird dieSortierung ist mit den ältesten Videos ganz oben und den neuesten Videos ganz oben. Ich muss also die gesamte Liste durchblättern, bevor ich die neu aufgenommenen Videos bekomme.

Irgendwelche Ideen, um das zu lösen?

 private void init_phone_video_grid() {

    System.gc();
    String[] proj = { MediaStore.Video.Media._ID,
            MediaStore.Video.Media.DATA,
            MediaStore.Video.Media.DISPLAY_NAME,
            MediaStore.Video.Media.SIZE };
    videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
            proj, null, null, null);
    count = videocursor.getCount();
    videolist = (ListView) findViewById(R.id.PhoneVideoList);
    videolist.setAdapter(new VideoAdapter(getApplicationContext()));
    videolist.setOnItemClickListener(videogridlistener);


}

private OnItemClickListener videogridlistener = new OnItemClickListener() {
    public void onItemClick(AdapterView parent, View v, int position,
            long id) {
        System.gc();
        video_column_index = videocursor
                .getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
        videocursor.moveToPosition(position);
        String filename = videocursor.getString(video_column_index);



        String videoinfo[] = new String[2];

        int videoId = videocursor.getInt(videocursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID));

        Cursor videoThumbnailCursor = managedQuery(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI,
                thumbColumns, MediaStore.Video.Thumbnails.VIDEO_ID+ "=" + videoId, null, null);


        if (videoThumbnailCursor.moveToFirst()) {

            thumbPath = videoThumbnailCursor.getString(videoThumbnailCursor.getColumnIndex(MediaStore.Video.Thumbnails.DATA));
            Log.d("ThumbPath: ",thumbPath);

        }

        videoinfo[0] = filename;
        videoinfo[1] = thumbPath;

        Intent intent = new Intent(StoredVideo.this, VideoCompress.class);
        intent.putExtra(EXTRA_MESSAGE, videoinfo);

        StoredVideo.this.startActivity(intent);


    }
};

Antworten auf die Frage(1)

Ihre Antwort auf die Frage