Getting Image Dimentions ONLY from a folder inside another folder which is in Assets saving maximum Memory in Android -
i need image dimensions folder inside folder in assets folder. have tried codes unable save memory i.e don't want load image memory want dimensions of files in folder. here code using not memory efficient don't want load bitmaps.
private void getfilenames() { assetmanager assetmanager = mcxt.getassets(); inputstream bitmap; bitmap bit; log.d("jawad"," in function"); // names of files inside "files" folder try { string[] files = assetmanager.list(mfolferpath); log.d("jawad"," length "+files.length); for(int i=0; i<files.length; i++) { if(files[i].contains(".png") ||files[i].contains(".jpg")) { log.d("jawad","" +files[i]); bitmap=assetmanager.open(mfolferpath+"/"+files[i]); bit=bitmapfactory.decodestream(bitmap); log.d("jawad",""+ " ," +bit.getwidth() + " , " + bit.getheight()); bitmap = null; bit.recycle(); bit = null; } } } catch (ioexception e1) { log.d("jawad"," "+e1); } }
mfolferpath = gfx/decoration/biscuits
this code giving me dimensions again problem don't want load them memory.
to dimensions of image decode bitmapfactory.options.injustdecodebounds set true.
bitmapfactory.options bitmp_options = new bitmapfactory.options(); bitmp_options.injustdecodebounds = true; bitmapfactory.decodestream(bitmap, null, options); int currentimageheight = bitmp_options.outheight; int currentimagewidth = bitmp_options.outwidth;
Comments
Post a Comment