Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Developer
Posts: 65
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook
Accepted Solution

Different Layout for BB10 Phones and PlayBooks?

Hi,

In Android 4.1.2, I use "layout" and "layout-sw600dp" folders to differentiate xml layouts for phones and tablets. However I cannot use that for 2.3.3 as they started supporting such feature from 3.2. And anyways, it doesnt affect as far as android is concerned because there's no tablet out there with Androd 2.3.3. 

 

But BB10  phones and tablets support only 2.3.3 runtime. So is there anyway I can declare different layout for Phones and PlayBooks in a single application project? Otherwise I need to make two different applications one for Phones and One for Tablets. Please let me know what's the best way to support different screen sizes.

 

Thanks,

Karthik

BlackBerry Development Advisor
Posts: 82
Registered: ‎11-21-2008
My Device: Z10

Re: Different Layout for BB10 Phones and PlayBooks?

Hello karthikpalanivelu,

 

For the BlackBerry PlayBook tablet, you can use the drawable-mdpi folder, and for BlackBerry 10 devices you can reference the drawable-xhdpi folder.

 

I think that you will find the following porting guide of use.

 

Port your Android app from BlackBerry PlayBook OS to BlackBerry 10 OS

http://developer.blackberry.com/android/documentation/port_android_app_pb_to_bb10.html

 

I hope that this has adequately addressed your concern.

James Dreher
BlackBerry Development Advisor
New Developer
Posts: 65
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook

Re: Different Layout for BB10 Phones and PlayBooks?

Hi James,

Thanks for your response. I am not actually concerned about the images. Anyways I have my images at all the respective folders drawable-hdpi, drawable-mdpi and drawable-xhdpi. But I am concerned about the layout xml files. layout-sw600dp was implemented from Android 3.2. As there's no tablet with Android 2.3.3, there is no necessity for Google to provide different layout scheme at that time. As BB Android Runtime is based on Android 2.3.3, it does not recognize loayout-sw600dp folder to pick the layout xml files. It takes from default layout-folder.

Thanks,
Karthik
New Contributor
Posts: 4
Registered: ‎02-04-2012
My Device: PlayBook

Re: Different Layout for BB10 Phones and PlayBooks?

[ Edited ]

You can use layout-xlarge for the PlayBook and layout for the phones, just as you would do to support Honeycomb devices and phones in one app.

New Developer
Posts: 65
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook

Re: Different Layout for BB10 Phones and PlayBooks?

Thank you so much. It works perfect :smileyhappy:
Regular Contributor
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!

Re: Different Layout for BB10 Phones and PlayBooks?

Ok, wait a sec here. We have phones that are 768x1280 and phones that are 720 x 1280 and then 720 x 720. So how does using just "layout" help differentiate between these? Ok, maybe that wasn't the exact question the poster was asking but still.

We need to know how to target each of those sizes, not to mention the playbook size of 1024 x 600
New Developer
Posts: 65
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook

Re: Different Layout for BB10 Phones and PlayBooks?

I think, unlike drawable folder, this layout xmls are not picked according to resolution. It's picked according to screen size. So, BB 10 smartphones pick from layout folder, PlayBooks pick from layout-large or layout-xlarge. May be they reserved xlarge for 10" PlayBook if they release it in future. But now, you can use either layout-large or layout-xlarge for PlayBooks. It works.

Regular Contributor
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!

Re: Different Layout for BB10 Phones and PlayBooks?

[ Edited ]

Layouts are picked according to both resolution and size. So you can have a layout-normal-hdpi folder and a layout-large-mdpi folder. Where "large" and "normal" indicate the screen size and hdpi and mdpi indicate the resolution.

 

So the issue for developers right now is this:

We have to target 4 different divices sizes

 

Playbook size: 1024 x 600

768x 1280

720 x 1280

720 x 720

 

Now for unreleased phones we don't exactly know whether these are mdpi, hdpi, xhdpi or what. We also don't know the physical size of them. So we are sort of up a creek for those. For the Z10 and Q10 that have been annouced we know that they are:

Z10: 4.2 inch, 356 ppi, 768 x 1280 display

Q10: 3.1 inch, ~329 ppi, 720 x 720 display

 

So they are both in the xhdpi category. The size is less clear. Some experimentation is needed. I suspect large for the Z10 and Small for the Q10, but it could be Normal for the Z10 and Small for the Q10 as well. Or Q10 could be Normal sized.

 

UPDATE: Alpha Dev Simulator is xhdpi-large, but strangely the pixels are showing up as  864x1400 using:

Display display = getWindowManager().getDefaultDisplay(); 

        int width = display.getWidth();  // deprecated

        int height = display.getHeight();  // deprecated

So I'm trying to figure that one out.