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

Native Development

Reply
Developer
FredTBB
Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10
Accepted Solution

Problem with number of display

Hi,

 

I wrote the following code:

 

screen_create_context(&m_screen_cxt, SCREEN_APPLICATION_CONTEXT);
screen_get_context_property_iv(m_screen_cxt, SCREEN_PROPERTY_DISPLAY_COUNT, &count);

I'm surprised because when i run this with the phone unattached to an external display, the count value is still 2. AFAIR, it was 1 in 10.0.9 SDK. I wrote a code that take advantage of dual display with cascade. how can I be sure a second screen is attached to the device?

 

Thanks for any help.

 

Fred

 

Please use plain text.
Developer
DrShavargo
Posts: 133
Registered: ‎05-10-2013
My Device: Blackberry Z10

Re: Problem with number of display

Teh display count returned 2 as well when I used that code. The and use SCREEN_PROPERTY_DISPLAYS to find the type of displays being retruned. From what I've seen, it's probably returning device (the actual hardware screen) and internal (the meta-physical, or software, screen).

----------------------------------------
Remember to mark the thread as solved at the post that solved your problem, and if you like a post, like it!
Please use plain text.
BlackBerry Development Advisor
tolang
Posts: 47
Registered: ‎04-19-2013
My Device: I love them all!

Re: Problem with number of display

The second display is the HDMI, and if you query it you will see (if the cable is not plugged in) that the display is listed as not attached.
Please use plain text.
Developer
FredTBB
Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10

Re: Problem with number of display

Yes, I've been able to discover if the screen is attached or not.

what puzlles me is that I don't see any utility to this call if it always returns 2... And my code was working in previous release, I didn't had to check if screen was attached or not.

Please use plain text.
BlackBerry Development Advisor
tolang
Posts: 47
Registered: ‎04-19-2013
My Device: I love them all!

Re: Problem with number of display

Nothing has changed, so perhaps I didn't understand the intial concern. Since 10.0, querying the number of displays should return (at least) 2. The primary device display, which is always attached, and the HDMI display, which is conditionally attached. With the addition of Miracast this becomes an interesting mix of HDMI being used, but no cable being plugged in, btw. So, for my poor caffeine deprived mind, could you clarify what your concern here is? :smileyhappy:
Please use plain text.
Developer
FredTBB
Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10

Re: Problem with number of display

I had a code using this, and I was testing the return with 1 or 2 to know if a display was attached. As my code was working previously, I assume the return was 1. I may be wrong, and i will not reinstall previous ndk to double check. anyway if it's the way it supposed to work. I'm not using this anymore, and i'm using directly a code to verify that a display is attached, and my code is working, so no more worries.

 

Thanks for your help,

 

Fred

 

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Problem with number of display

You can tell if a display is attached - by asking the screen apis if it's attached.

 

for (int i = 0; i < displays.size(); ++i) {
  int attached(0);
  screen_get_display_property_iv(displays[i], SCREEN_PROPERTY_ATTACHED,
				&attached);

 

--
Rob is no longer associated with BlackBerry.
Please use plain text.