2010-12-07 1 views
0

ビデオサムネイルでビデオプレーヤーのリストを作成しました。 scorllの表示時間は非常に遅いです.. 私はどのように高速ビデオthumnailを表示できますか?ビデオのリストは8行です。ソース - >Android:非常に高速の動画サムネイルを表示できますか?

ImageView imageView = null; 
Bitmap bm = null; 

bindView(View view, int iViewType, Context context,Cursor cursor, boolean bExpand) 
{ 
bm= MediaStore.Video.Thumbnails.getThumbnail(vmcontext.getContentResolver(),index, MediaStore.Video.Thumbnails.MINI_KIND, null); 
imageView.setImageBitmap(bm); 
} 

ビデオサムネイルを表示できます。リスト表示やスクロール表示は非常に遅いです。

答えて

1

簡単な方法は、独自のコンテンツをキャッシャーにすることです。例えば

ImageView imageView = null; Bitmap bm = null; 
HashMap<String, ImageView> cacher = new HashMap<String, ImageView>(); 

bindView(View view, int iViewType, Context context,Cursor cursor, boolean bExpand) 
{ 
    if (cacher.containsKey("id")) 
    { 
    imageView.setImageBitmap(cacher.get("id")); 
    } 
    else 
    { 
    bm= MediaStore.Video.Thumbnails.getThumbnail(vmcontext.getContentResolver(),index, MediaStore.Video.Thumbnails.MINI_KIND, null); 
    cacher.put("id", bm); 
    imageView.setImageBitmap(bm); 
    } 
} 

これは良いですが、あなたのサムネイルのスクロールビューの表示であれば、ユーザが上下にスクロールし、何度も同じサムネイル。最後に、すべてのキャッシュされたコンテンツが円滑なスクロールを行います。

さらに、親指のグリッドが表示される前にAsyncTaskを使用して、可能であればサムネイルのプリフェッチを行い、キャッシャーにデータを取り込むことができます。

メモリをいっぱいにしないようにキャッシャを制限してフラッシュしてください。

トビヤ

関連する問題