How to restrict j2me application in the Landscape mode only - java-me

I am developing application using J2ME and LWUIT.I want to run this application on landscape mode only.
For Nokia there is an attribute : Nokia-MIDlet-App-Orientation: landscape but for other device , What is the attribute to restrict the application to landscape mode only?
How to achieve this for different J2ME devices?

Following is the attribute to restrict application in landscape mode only.
Nokia device:
Nokia-MIDlet-App-Orientation : Landscape
Samsung device:
MIDlet-ScreenMode : Landscape

If you want to lock the screen orientation in LWUIT, you must use a combination of the following methods.
Display.isPortrait() Returns true if the device is currently in portrait mode.
Display.canForceOrientation() Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature.
Display.lockOrientation(boolean portrait)On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode
I hope this can help you.

I check the method Display.canForceOrientation() this give you the wrong answer because the value in the LWUITImplementation.java is hard coded and always return false. So in LWUIT if we want to restrict application the only way to do this is to add a JAD attribute through code it not possible.

Related

How can I configure MRTK to work with touch input in editor and on mobile devices?

I'm building an application that will run on both HoloLens and mobile devices (iOS/Android). I'd like to be able to use the same manipulation handlers on all devices with the goals:
Use ARFoundation for mobile device tracking and input
Use touch input with MRTK with ManipulationHandler and otherwise use touch input as normal (UI)
Simulate touch input in the editor (using a touch screen or mouse) but retain the keyboard/mouse controller for camera positioning.
So far I've tried/found:
MixedRealityPlayspace always parents the camera, so I added the ARSessionOrigin to that component, and all the default AR components to the camera (ARCameraManager, TrackedPoseDriver, ARRayCastManager, etc.)
Customizing the MRTK pointer profile to only countain MousePointer and TouchPointer.
Removing superfluous input data providers.
Disabling Hand Simulation in the InputSimulationService
Generally speaking, the method of adding the ARSessionOrigin to the MixedRealityPlayspace works as expected and ARFoundation is trivial to set up. However, I am struggling to understand how to get the ManipulationHandler to respond to touch input.
I've run into the following issues:
Dragging on a touch screen with a finger moves the camera (editor). Disabling the InputSimulationService fixes this, but then I'm unable to move the camera...
Even with the camera disabled, clicking and dragging does not affect the ManipulationHandler.
The debug rays are drawn in the correct direction, but the default touchpointer rays draw in strange positions.
I've attached a .gif explaining this. This is using touch input in the editor. The same effect is observed running on device (Android).
This also applies to Unity UI (world space canvas) whereby clicking on a UI element does not trigger (on device or in editor), which suggests to me that this is a pointer issue not a handler issue.
I would appreciate some advice on how to correctly configure the touch input and mouse input both in editor and on device, with the goal being a raycast from the screen point using the projection matrix to create the pointer, and use two-finger touch in the same way that two hand rays are used.
Interacting with Unity UI in world space on a mobile phone is supposed to work in MRTK, but there are few bugs in the input system preventing it from working. The issue is tracked here: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5390.
The fix has not been checked in, but you can apply a workaround for now (thanks largely to the work you yourself did, newske!). The workaround is posted in the issue. Please see https://gist.github.com/julenka/ccb662c2cf2655627c95ffc708cf5a69. Just replace each file in MRTK with the version in the gist.

Rotating IPad Screen Orientation on Different Views

I have an iPad application that opens up in portrait mode but when I switch to another view I need to force the orientation to landscape so that the user realises they need to physically move the screen orientation to landscape, and then when they leave this view I need to force the orientation back to portrait.
I can see the ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) which if believe correctly just restricts the orientations that are possible for the view but setting this to one orientation (e.g. UIInterfaceOrientation.LandscapeRight) doesn't force the orientation to change.
I've seen some other suggestions about forcing the View to rotate using this.View.Transform.Rotate(...) but doesn't seem to work for me.
Just wondering if anyone had any suggestions or be able to point me in the right direction?
Thanks
Are your views all displayed within a single uinavigationcontroller?
If they are, then I'm afraid that the answer is that you cannot achieve what you are looking to - see a full explanation, including links to the Apple developer docs on: How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?
If you do want to achieve the effect you are looking for the, then maybe switch to using some other "parent" for all your child views - e.g. displaying them modally?
First, set ShouldAutorotateToInterfaceOrientation to support landscape orientation only.
Then use this hack to force orientation change:
var c = new UIViewController ();
PresentModalViewController (c, false);
DismissModalViewControllerAnimated (false);

How do I lock the screen orientation to landscape during a scene in cocos2d?

I am using box2d for ios app development.I would like to fix device orientation to landscape left which comes default in cocos2d.
How would I go about locking the screen orientation so that it cannot be changed while the user is playing?
Here's the answer to your question:
System ignore iPhone rotation
You tell the OS to ignore system rotations.
In Cocos2D open the GameConfig.h and change the Autorotation macro according to its documentation to disable autorotate support.

Problems with supporting tablets and handsets simultaneously - orientation

In my main Game Activity I force the orientation to portrait. This is clearly not a good idea on tablets. What is the best way to check the SDK version and not do this for tablets (or perhaps even force landscape)? I assume I then need to specify a layout-land-large folder and put the files in there. Is there anything else I need to do? I read something somewhere that I also need to specify screen sizes somewhere in the manifest.
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
I.e. should it be in -large or xlarge?
I would definitely check out the documentation here.
You can simply declare two different layouts in and folders specifying two different View orientations.
Please let me know if you need any clarification, and I'll get back to you :)
Hope this helped!
res/values for handsets in portrait mode.
res/values-sw600dp for 7" tablet in portrait mode
res/values-sw720dp for 10" tablet in portrait mode
res/values-sw720dp-land for 10" tablet in landscape mode
and reference to Android Developer Guide -- How to support multiple screens

Is it possible to hide the RootViewController of a SplitView iPad app in landscape mode?

I have an iPad app that uses the RootViewController/DetailViewController pattern like most iPad apps. As usual, in landscape mode my RootViewController is "docked" to the left side of the screen, and the DetailViewController fills up the remainder of the screen.
What I would like to do is hide the RootViewController and allow the detail view to fill up the entire screen even in landscape mode. Is this possible?
I tried calling dismissPopoverAnimated, but this doesn't seem to have any effect in landscape mode.
since u have tagged ios4, I would like to say that that option has been disabled in ios 4.. it was possible in ios 3 but I am not able to find out how...

Resources