I have an ImageView which I want to set the size of programmatically. So I don't have the option of putting different-sized images in their respective drawable folders.
Basically, instead of doing what I've done below, I want to set the LayoutParams according to the screen resolution. If the device is ldpi or mdpi, then 100,100... if it was hdpi, then 150,150 etc. How can I achieve this?
ImageVIew imageView = new ImageView(this);
imageView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
layout.add(imageView);
 
     
     
     
     
     
     
    