My application load images from server via HTTP and save it into files. Then I use this code to get Drawable and view it:
File f=new File(path);
if(f.exists()) {
Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath());
if(bmp!=null) {
DisplayMetrics dm = m_activity.getResources().getDisplayMetrics();
bmp.setDensity(dm.densityDpi);
Drawable drawable=new BitmapDrawable(context.getResources(), bmp);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
return drawable;
}
}
It working fine on Samsung Galaxy S2. But on Samsung Galaxy S4 this images too small. For example:
On S2:
On S4:
I need to display it equally on all devices with various display's resolution. Is it possible? How to implement this?