How can I check if a video/image file is valid in Android. The image/video files are provided by querying the content provider.
I want to check if the image/video file can be decoded.
The picture with problems...
How can I check if a video/image file is valid in Android. The image/video files are provided by querying the content provider.
I want to check if the image/video file can be decoded.
The picture with problems...
For Image
public class IsImageFile implements FileFilter
{
File file;
private final String[] okFileExtensions = new String[] {"jpg", "png", "gif","jpeg"};
public ImageFileFilter(File newfile)
{
this.file=newfile;
}
public boolean accept(File file)
{
for (String extension : okFileExtensions)
{
if (file.getName().toLowerCase().endsWith(extension))
{
return true;
}
}
return false;
}
}
You can do like this for video also