[英]What is the best way to check programatically if a file is corrupted or not in android?
What is the best way to check programmatically if a file is corrupted or not in android, in particular when dealing with an image video or audio file ?在android中以编程方式检查文件是否损坏的最佳方法是什么,特别是在处理图像视频或音频文件时?
I would like to be able to spot those corrupted file that on some devices (Samsung) keep the media service busy as it is probably trying indexing them, and as a consequence drain the battery我希望能够在某些设备(三星)上发现那些损坏的文件,这些文件使媒体服务忙碌,因为它可能正在尝试对它们进行索引,从而耗尽电池
TIA TIA
Android Supported Media Formats read the document Android Supported Media Formats阅读文档
For crashing problem please put your code in a try...catch block
like below,对于崩溃问题,请将您的代码放在try...catch block
中,如下所示,
try
{
// Code to play the media file.
}
catch ( Exception e )
{
// Display a Toast message, "File format doesn't support"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.