授权码是什么?域名备案怎么关联云服务?
试试这个代码吧:
public class ImageFileFilter 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;
}
}
你可以尝试按如下方式通过BitmapFactory解析文件:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(path, options);
if (options.outWidth != -1 && options.outHeight != -1) {
// This is an image file.
}
else {
// This is not an image file.
}