how to set pixels according to device in blackberry?
I have developed a black开发者_JS百科berry application, but I have to one issue, that the images and output is different of different devices, like in 9000 bold it is perfect, but in blackberry curve 8520, it is enlarging, what should I do?
Different screens are different sizes with different resolutions. There are multiple things that you can do here:
Create multiple projects/versions of your application, each one for a different screen resolution. Each project will have images of the appropriate size for the targeted resolution.
In the res/ folder of your project, create subfolders each holding a different set of images (for different resolutions). When the application starts, detect the screen resolution and set a global variable containing the path of the appropriate resolution. Then, wherever you instantiate your bitmaps, use the global variable to select the image from the appropriate subfolder.
Rather than using a lot of images, use the BlackBerry graphics API to create graphics as fields. You can make the width and height of these graphics relative based on screen size, font size, etc. The advantage here is that everything will scale nicely.
- Scale your images based on screen size - I've tried this, and I don't recommend it unless you are dealing with only a couple of graphics. The scaling usually doesn't look great.
精彩评论