本规范对我不起作用。
long length = file.length();
length = length/1024;
是否有其他方法可以获取文件大小?
答案 0 :(得分:0)
File file =new File("//data/data/Your-Application-Package-Name/File/your-file-name"); double bytes = file.length(); double kilobytes = (bytes / 1024); double megabytes = (kilobytes / 1024);Log.d("file size","size of file in KB:"+kilobytes); Log.d("file size","size of file in MB:"+megabytes);