2011-08-08 14 views
5

私はアプリケーションを作成しており、リストに記録されたすべてのビデオをリストしています。文字列の代わりにUriの助けを借りてサムネイルを作成することは可能ですか?Android:ビデオURIからビデオサムネイルを作成

私の現在のコードは以下の通りですが、コンストラクタへの入力がUriではなく文字列であるため動作しなくなりました。

bmThumbnail = ThumbnailUtils.createVideoThumbnail(
        (db_results.get(position)), Thumbnails.MICRO_KIND); 
      imageThumbnail.setImageBitmap(bmThumbnail); 

私は事前に誤りにお時間を

The method createVideoThumbnail(String, int) in the type ThumbnailUtils is not applicable for the arguments (Uri, int) 

感謝を返されています。

答えて

6
public String getRealPathFromURI(Uri contentUri) { 
    String[] proj = { MediaStore.Images.Media.DATA }; 
    Cursor cursor = managedQuery(contentUri, proj, null, null, null); 
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); 
    cursor.moveToFirst(); 
    return cursor.getString(column_index); 
} 
+0

それは動作しません:(.getpathを(なし)は、それがコンテンツを削除する代わりに、ビデオの正確な位置を盗んません:。唯一//一部 –

+1

http://stackoverflow.com/questions/ 3401579/android-get-filename-and-path-from-uri-from-mediastoreは私の問題を解決しました。あなたの答えを更新してください。 –

関連する問題