Java tutorial
//package com.java2s; import android.content.Context; import android.text.TextUtils; import java.io.File; public class Main { public static long getFileSize(Context context, String filePath) { if (context != null && !TextUtils.isEmpty(filePath)) { File f = new File(filePath); if (f.exists() && f.isFile()) { return f.length(); } } return -1l; } public static boolean isEmpty(String s) { return s == null || s.trim().length() == 0; } }