String filePath = Environment.getExternalStorageDirectory().toString() + "/toplogic.mp4"; File file =new File(filePath); if(file.exists()){ double bytes = file.length(); double kilobytes = (bytes / 1024); double megabytes = (kilobytes / 1024); double gigabytes = (megabytes / 1024); double terabytes = (gigabytes / 1024); double petabytes = (terabytes / 1024); double exabytes = (petabytes / 1024); double zettabytes = (exabytes / 1024); double yottabytes = (zettabytes / 1024); Toast.makeText(getApplicationContext(),"File size : " + megabytes , Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(),"File does not exists!" , Toast.LENGTH_SHORT).show(); }
글목록
2014. 4. 30.
[Android] How to get filesize in android
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기