I’m adding images to screens depending on screen resolution. So depending on the screen resolution I add the approprate sized image. Does this fall into any design pattern? Or is there a design pattern that better suits this requirement ?
ImageFactory.getBitmap();
public static Bitmap getBitmap(){
if(screenWidth == 360 && screenHeight== 480){
return new Bitmap("360480.bmp");
}
else {
return new Bitmap("320240.bmp");
}
}
This looks like a factory pattern. Your factory is smart about which bitmaps to create/return by taking the screen size into account, and from what I’m seeing I think you are doing alright there.
While you are at it, you might want to think about the naming pattern for the images (I think something like “640×480.bmp” is easier to the eye than “640480.bmp”).