Android phone orientation overview including compass

You might want to check out the One Screen Turn Deserves Another article. It explains why you need the rotation matrix. In a nutshell, the phone’s sensors always use the same coordinate system, even when the device is rotated. In applications that are not locked to a single orientation, the screen coordinate system changes when … Read more

How to lock orientation during runtime

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Called on an activity, will lock it to landscape. Look for the other flags in the ActivityInfo class. You can lock it back to portrait or make it sensor/slider driven. More info here: http://www.devx.com/wireless/Article/40792

Android – Camera preview is sideways

This issue appeared to start out as a bug with certain hardware see here but can be overcome by using the call to mCamera.setDisplayOrientation(degrees) available in API 8. So this is how I implement it: public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (isPreviewRunning) { mCamera.stopPreview(); } Parameters parameters = mCamera.getParameters(); … Read more

Android: alternate layout xml for landscape mode

By default, the layouts in /res/layout are applied to both portrait and landscape. If you have for example /res/layout/main.xml you can add a new folder /res/layout-land, copy main.xml into it and make the needed adjustments. See also http://www.androidpeople.com/android-portrait-amp-landscape-differeent-layouts and http://www.devx.com/wireless/Article/40792/1954 for some more options.

Android WebView: handling orientation changes

If you do not want the WebView to reload on orientation changes simply override onConfigurationChanged in your Activity class: @Override public void onConfigurationChanged(Configuration newConfig){ super.onConfigurationChanged(newConfig); } And set the android:configChanges attribute in the manifest: <activity android:name=”…” android:label=”@string/appName” android:configChanges=”orientation|screenSize” for more info see: http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange https://developer.android.com/reference/android/app/Activity.html#ConfigurationChanges

Lock screen orientation (Android) [duplicate]

In the Manifest, you can set the screenOrientation to landscape. It would look something like this in the XML: <activity android:name=”MyActivity” android:screenOrientation=”landscape” android:configChanges=”keyboardHidden|orientation|screenSize”> … </activity> Where MyActivity is the one you want to stay in landscape. The android:configChanges=… line prevents onResume(), onPause() from being called when the screen is rotated. Without this line, the rotation … Read more

How do I lock the orientation to portrait mode in a iPhone Web Application?

This is a pretty hacky solution, but it’s at least something(?). The idea is to use a CSS transform to rotate the contents of your page to quasi-portrait mode. Here’s JavaScript (expressed in jQuery) code to get you started: $(document).ready(function () { function reorient(e) { var portrait = (window.orientation % 180 == 0); $(“body > … Read more

Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?

Yes, it’s orientation-dependent in iOS8, not a bug. You could review session 214 from WWDC 2014 for more info: “View Controller Advancements in iOS 8” Quote from the presentation: UIScreen is now interface oriented: [UIScreen bounds] now interface-oriented [UIScreen applicationFrame] now interface-oriented Status bar frame notifications are interface-oriented Keyboard frame notifications are interface-oriented

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)