android - How to get total video & image size from external SD card -
I am trying to calculate the total memory size (video and image) from an external SD card. For example, a method is There is no such way as Try the following code: - function getRealPathFromURI mediastore.audio.media.gate contactUrifpath (string path) . From where I can get the URI and calculate size audio files. Passing ..
Private long mill media (Uri Yuri) {Log. ("URI", "Yuri +"); String [] project = {MediaStore.MediaColumns.SIZE}; Cursor cursor = ((activity) reference) .Get content resolver (). Query (Yuri, Prose, Blank, Blank, Blank); Long size = DirectoryMediaSize.getMediaSize (cursor); Cursor.close (); Return size; }
MediaStore.Video.Media.getContentUriForPath () . So how can I calculate the size for (in the video & image) ???
URI selected IMAGEURI = data.getData (); File image file = new file (getRealPathFromURI (selected imageURI)); Long check = ((imageFile.length () / 1024); If (Check & lt; 5000) {// less than 5 MB} else {// greater than 5 MB}
string mill rialpathformu (Uri materialurai) {string result; Cursor cursor = getContentResolver (). Query (contentURI, empty, empty, empty, empty); If (cursor == zero) {// Source dropbox or other similar local file path is result = contentURI.getPath (); } Else {cursor.moveToFirst (); Int idx = cursor.getColumnIndex (MediaStore.Images.ImageColumns.DATA); Result = cursor.juststring (idx); Cursor.close (); } Return results; }
Comments
Post a Comment