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
icaro90302
Posts: 39
Registered: ‎09-28-2010
My Device: Not Specified

Problems with class UiEngineInstance

Hello to everyone!

 

Need help with a problem I have. 

 

I need to use the class UiEngineInstance to block screen but at phones with OS less than 4.7.0 does not work.

 

I don't want to use the functions of that class in those phones, simply I do want that not call that class.

 

Here's the code:

 

 

try {
	if (net.rim.device.api.ui.Touchscreen.isSupported()) {
		net.rim.device.api.ui.UiEngineInstance ui = net.rim.device.api.ui.Ui.getUiEngineInstance();
	    int acceptableDirections = 0;
	    if(net.rim.device.api.system.Display.getWidth() > net.rim.device.api.system.Display.getHeight())
	    	acceptableDirections = net.rim.device.api.system.Display.ORIENTATION_LANDSCAPE;
	    else
	    	acceptableDirections = net.rim.device.api.system.Display.ORIENTATION_PORTRAIT;
	    	
	    ui.setAcceptableDirections(acceptableDirections);
	}
} catch (Exception e) {}

 

 

Unfortunately to make two versions is not an option for my company.

 

Can someone help me?

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Problems with class UiEngineInstance

If you really want to lock the user into the current orientation, you are stuck with having two versions - TouchScreen, ORIENTATION_LANDSCAPE and a lot of other stuff is 4.7+ only.

 

However - why on Earth would you want to do this "orientation locking"? The whole piece of code is extremely confused. The fact that you are content to lock the user in any orientation suggests that your application is ready to handle either. Why not handle both? What exactly are you trying to achieve?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.