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

Java Development

Reply
Contributor
Posts: 43
Registered: ‎01-19-2011
My Device: lets say: I don't own CDMA Variants
My Carrier: T-Mobile Austria

Get Screen Direction

Hi,

 

is there a way to get the actuall Screen Direction.

 

with

UiEngineInstance.setAcceptableDirections( int direction )

 I'm able to set them, but I can't find any method to get the current direction.

 

Display.getOrientation() 

does not work for me.

 

Kind regards

Peter

 

 

________________
mappau Dev Team
blackberry@mappau.com twitter.com/#!/mappau facebook.com/mappau.at
Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: Get Screen Direction

Is it not works for you?

 

public int getOrientation()
	{
		if(Display.getOrientation() == Display.DIRECTION_EAST)
			return someConstant;
		else if(Display.getOrientation() == Display.DIRECTION_LANDSCAPE)
			return someConstant;
		else if(Display.getOrientation() == Display.DIRECTION_NORTH)
			return someConstant;
		else if(Display.getOrientation() == Display.DIRECTION_PORTRAIT)
			return someConstant;
		else if(Display.getOrientation() == Display.DIRECTION_WEST)
			return someConstant;
	}

 

Thanks.

 

 

Highlighted
Contributor
Posts: 43
Registered: ‎01-19-2011
My Device: lets say: I don't own CDMA Variants
My Carrier: T-Mobile Austria

Re: Get Screen Direction

Hi,

 

it's not working because

 

getOrientation()

 

Returns:

ORIENTATION_***

and not

DIRECTION_***
________________
mappau Dev Team
blackberry@mappau.com twitter.com/#!/mappau facebook.com/mappau.at