Blackberry supporting multiple screens - blackberry

I have developed my BlackBerry app for screen resolution 320x240. Now I need it to support screens of multiple resolutions.
Where do I store images for different resolutions and access them accordingly through code, without making separate build for every screen resolution?
If possible please provide me the various screen sizes available for BlackBerry, that need to be ported.

Different Screen Resolutions are -
240 x 240 7730
240 x 320 8220 8230
320 x 240 8520 9300 9330 8310 8530 8830 8320 8330 8700c 8820 8800 8300 8707v 8330 8500
curve3G 9220
360 x 400 9670 9105 9100 pearl3G
360 x 480 9800 9500 9370 9350 9780 9520 9550 9530 9670
480 x 320 9000
480 x 360 9650 9700 9630 8900 9360
480 x 800 9860 9850 storm3 volt
640 x 480 Bold 9900
int device_h = Display.getHeight();
int device_w = Display.getWidth();
if(device_h==240 && device_w== 320 ){
//select image of that size
}
else if(device_h==480 && device_w== 360){
//select image of that size
} and so on.....
Store the different images in separate folder in res folder of your project.

yea wont that increase the size of project?
wat I have found is you can store images of good resolution and scale them according to the device sizes using the following code
int barW = Fixed32.div(Fixed32.toFP(bitmap.getWidth()), Fixed32.toFP(scaleW));
int barH = Fixed32.div( Fixed32.toFP(bitmap.getHeight()), Fixed32.toFP(scaleH));
Bitmap scaledBitmap =
EncodedImage.getEncodedImageResource(img).scaleImage32(barW, barH).getBitmap();
This seems to work fine too :)

Related

What pixel size do images need to at least fill the iPhone 6 Plus display?

The iPhone 6 Plus has 414 x 736 points. It renders at 3x to get 1242 x 2208 pixels, which are mapped to 1080 x 1920 of physical pixel.
Since the physical pixels are the pixels which are actually drawn and shown to the user, I guess that full screen images have to be at least 1080 x 1920 px to match the full screen potential. Each image which is bigger than that will be downscaled to 1080 x 1920 px.
Am I right that you need at least have full screen images in size 1080 x 1920 px to get the best resolution on an iPhone 6 Plus?
Do not confuse with 'mapped to physical size'. You just use 1242 x 2208 px size for you full screen images.
The screen bounds of iPhone6+ is;
NSLog("Screen Size \( UIScreen.mainScreen().bounds)"); // on iPhone 6+ - 414 x 736 (1x)
Which we are using in our development calculations so,
in development, there is no concept of physical screen size. it is handled by the device at its own.

How to compute the correct image Sizes for different iOS Displays?

I have a logo image which should be displayed at 95 x 95 pt at iPhone6. This means the logo image has size 190 x 190 px since iPhone6 scales at 2x.
What is the correct size in px for this image on iPhone6Plus to have the same size?
iPhone6Plus scales at 3x this would lead to 285 x 285 px.
But, you can also computed it differently too.
Screen size in px:
iPhone6: 750 x 1334 px
iPhone6Plus: 1242 x 2208 px
Now you can compute:
190 / 750 = x / 1242
and solve this for x. This leads to 314 x 314 px.
So I get two different values for the correct image size on iPhone6Plus.
285 x 285 px and 314 x 314 px.
Which one is correct?
In Xcode you can now use vector pdf images. It will then scale them automatically when building. Support for this has become better in Xcode 7.
This will automatically generate all the sizes you need, this essentially future proofs your image assets.
a guide to vector assets
a link to all the awesomeness that assets can do now
The scaling on the 6+ is a little bit tricky.
You need to multiply the #2x size by 1.5.
Here is an example:
You got an image of 100x100px.
You need an image of 150x150px to be displayed on your iPhone 6+ in clear definition. (#3x)
Here is a useful link:
Icon & imagesizes on iOS devices

Xcode 6 - universal image support

I am wondering which image sizes are needed with new XCode 6 and iPhone 6 and iPhone 6 plus support.
So if I am now having a fullwidth image, which is
640 x 80 pixel
for an iphone 4s/5 series. So with "#2x". For iPhone 6 plus I need the "#3x" as well. So that would be
1242 x 80 pixel
?
Update:
My goal is it to have a fullwidth image which looks good on every iphone or ipad (Size class any any).
Assuming that your 640 x 80 image is #2x, the #3x image size would be 960 x 120 (960 = 640 / 2 * 3)

iPhone UI Widget Sizing

I am laying out an interface in code within a view controller and it appears that I need to provide explicit sizing even for standard, simple widgets like buttons and labels (one would think they have intrinsic dimensions).
Does Apple publish official standard dimensions for these widgets?
How is this situation usually handled when interface builder is not being used?
For label there is not any standard dimensions but for buttons you should keep size of 44 X 44 px , so user can easily tap on it..
Make it easy for people to interact with content and controls by giving each interactive element ample
spacing. Give tappable controls a hit target of about 44 x 44 points. From
iOS Human Interface Guidelines - Apple Document
Check this standard-iphone-element-sizes blog.
I serached the document about iOS picture size, please see the document.
App icon resource sizes
Filename / Size of canvas (in pixels)
icon_512x512#2x / 1024 x 1024
icon_512x512 / 512 x 512
icon_256x256#2x / 512 x 512
icon_256x256 / 256 x 256
icon_128x128#2x / 256 x 256
icon_128x128 / 128 x 128
icon_32x32#2x / 64 x 64
icon_32x32 / 32 x 32
icon_16x16#2x / 32 x 32
icon_16x16 / 16 x 16
And in the program, follw iphone screen size,
width - 320
heigh - 480, so base on these sizes, you can adjust your picture.
(especially, twice the resolution for iPhone, 640*960 is nessary!)

BlackBerry Resolution

Is there any simulator with Resolution 680x800 in BlackBerry?
I have searched a lot..But I could not get specific Result..
Site from which I download Simulaors does not provide Resolution information..
http://swdownloads.blackberry.com/Downloads/contactFormPreload.do?code=060AD92489947D410D897474079C1477&dl=7A51789FDE2B3B44C6ED1BA5D80D53CB&check1=A
Please Help me...
Thanks in Advance
I do not believe that there is a BlackBerry device with that resolution.
Here is a list of some legacy BB devices: http://supportforums.blackberry.com/t5/Java-Development/List-of-Blackberry-Devices-with-resolution/td-p/556066
BlackBerry Playbook uses 1024 x 600.
Z10 is 768 x 1280
Q10 is 720 x 720
Also, there are no results on gsmarena.com for devices with a "680 x 800" or "800 x 680" screens.

Resources