String imageFilePath = "ftp://hostname/dir/imagefilename.jpg";
BitmapFactory.Options options = new BitmapFactory.Options;
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(imageFilePath, options);
int height = options.outHeight;
int width = options.outWidth;
但是height,width总是0。
我也尝试通过设置inJustDecodeBounds = false但仍然decodeFile方法正在返回null。
当我设置imageFilePath为本地图像文件时,它可以正常工作,并且对于来自普通网站的文件再次不起作用。http
对于那些想知道如何连接到 FTP 服务器的人,它已成功连接和验证,甚至我正在使用FTPClient.listFiles()andFTPClient.listNames()正确获取所有图像文件及其名称。