缩略图在Android,则返回null 4.0以上版本 [英] thumbnail returns null on android above version 4.0
本文介绍了缩略图在Android,则返回null 4.0以上版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到同样的<一个href=\"http://stackoverflow.com/questions/19048825/thumb-from-video-url-returns-null-on-android-4-0-and-above\">this
问题
I am getting the samethis issue
public class MainActivity extends Activity
{
ImageView imgVie;
Bitmap bmp,extBmp;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imgVie = (ImageView)findViewById(R.id.imageView1);
String path = "http://202.65.154.108:8080/VODStream/lokesh.stream.mp4";
bmp = ThumbnailUtils.createVideoThumbnail(path, Thumbnails.FULL_SCREEN_KIND);
if(bmp!=null)
{
extBmp = ThumbnailUtils.extractThumbnail(bmp, 300, 300);
imgVie.setImageBitmap(extBmp);
}
if(bmp==null)
{
Toast.makeText(getApplicationContext(), "Sorry your bitmap returns null", Toast.LENGTH_LONG).show();
}
}
}
运行nexus4s其进入,如果condition.In将其移动到其他的所有其他手机这个应用程序时。
你有什么建议。
when run this application in nexus4s its entering into if condition.In all other phones it moving to else. do you have any suggestions.
推荐答案
如果您的视频是在外部存储需要许可&LT;使用许可权的android:NAME =android.permission.READ_EXTERNAL_STORAGE/&GT;
If your video is on the external storage requires permission
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
这篇关于缩略图在Android,则返回null 4.0以上版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文