Android examples for android.content:ContentResolver
get File Length From ContentResolver
import java.io.InputStream; import android.content.ContentResolver; import android.net.Uri; public class Main { static long getFileLengthFromContent(ContentResolver paramContentResolver, Uri paramUri) { InputStream localInputStream = null; try {// w w w. j av a2 s.c o m localInputStream = paramContentResolver.openInputStream(paramUri); byte[] arrayOfByte = new byte[1024]; long l = 0L; int j; for (int i = localInputStream.read(arrayOfByte); i >= 0; i = j) { l += i; j = localInputStream.read(arrayOfByte); } return l; } catch (Exception localException) { throw ((RuntimeException) localException); } finally { } } }