android - How to calculate selected image size in gallery? -
have edited question make more clear.
basically working on app users need upload profile image. need limit size of image upload less 4mb. here user selects image image gallery, @ instant need check image file's size , show alert user if file size greater 4mb , restrict upload.
presently using code file size:
file img = new file(selectedimage.getpath()); int length = img.length();
i know length() returns file size in bytes, after conversion bytes mb, seems return small values original image file size leading me believe getting file size way inaccurate.
is there other way can file size of image files device gallery?
any appreciated. guys.
actually, question little bit unclear: size 'in kb' or youhave know how seen on screen??
will help?
Comments
Post a Comment