bitmap - Android decodeBitmap with size depend on density -
i trying decode bitmap using injustdecodebounds. outwidth , outheight width dimensions of original image. example if image in xxhdpi folder , phone xhdpi density , image 500 x 500px outwidth = 500, should smaller, since run on xhdpi ( don't have folder xhdpi drawables). there way while decoding use screen density. in advance.
here way load scaled down version of bitmap : http://developer.android.com/training/displaying-bitmaps/load-bitmap.html#load-bitmap
you can calculate reqwidth , reqheight values found here : http://developer.android.com/reference/android/util/displaymetrics.html
like :
int currentwidth = 500; displaymetrics metrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(metrics); reqwidth = currentwidth * (metrics.densitydpi/(float)displaymetrics.density_xxhigh );
Comments
Post a Comment