Portrait app shows as Landscape - android

I am an Android developer and have recently made an app for a client. The screen orientation should only be available in portrait, so I have added the option android:screenOrientation="userPortrait" to each and every activity in my manifest.
Despite this, my client keeps telling me that the app displays in landscape on her Samsung Tablet. I don't know why this may be, according with http://developer.android.com/guide/topics/manifest/activity-element.html the orientation should never be landscape. In all of my tests it is displaying correctly (portrait mode), but I don't have access to her device and don't know what is going on.
Any help would be appreciated. Thanks!

You should write this :
android:screenOrientation="portrait"

Related

Make android app to work in portrait or reverse portrait only

I am working on android app and wish to make this app work only in portrait or reverse portrait mode. In the manifest file I mentioned screen orientation value as "sensorPortrait" but app works only in portrait mode, i.e., if I hold my phone upside down, nothing changes in my app. Although, I do have other apps on my phone that work in both portrait and reverse portrait mode. I have seen similar question asked before but suggestion given don't work as those questions were asked way back and suggestion given might not be a good answer anymore. Any recommendations? Thanks!
You can add in your AndroidManifest.xml file, you need to configure the to use the orientation from the sensor. This should be the default, but you can force it to the sensor's orientations, for all 4 possible orientations, with android:screenOrientation="fullSensor"
<activity android:name=".MainActivity"
android:screenOrientation="fullSensor"/>

How can i stop orientation change in android table?

Hi i am developing android application in tablet version. Here i am facing problem with orientation so i want to make my application in portrait mode only. For that i Used attribute like below snippet for each and every activity in my application.
android:configChanges="keyboard|orientation|keyboardHidden"
android:screenOrientation="portrait"
Application is running perfectly while testing in portrait mode. But it is not good while testing application with tablet physical position with landscape. It is first going to landscape then immediately going to portrait.
I used programmatically making the activity in portrait but no effect. Please provide me any help.
Here is my programmatic orientation fix
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
I tested in Motorolo device
Please suggest me to avoid my application going to landscape.
Try this...
<activity
android:label="#string/app_name"
android:name="abc.xyz.dd.MainScreen"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation">
By adding this in manifest file it will prevent from changing to landscape mode.
Finally i find the reason why orientation changes are occurring in android tablet. In ICS (version 4.0+) the tablet have the option like "Don't keep activities" in settings>> Developer tools>>
If the user checked that option the paused activity will killed and created when it is call again. what i mean the activity won't go for onPause() state it will go for onDestroy() and it will created again when press on back key. So the orientation behavior is different.
I did not get the idea how to handle it from our android code

Handling orientation on lockscreen for an android app

Testing my application on my Galaxy S2 I have a problem whenever the screen is turned off and back on. My application is locked into landscape by the manifest. The lock screen forces the application into some weird orientation where it is rendering portrait but displaying it was landscape (as in the right 2/5 of my screen is black and the portrait rendering goes off the bottom). The application is also not responsive in this state. If I quickly hit home (or back) and recall the application it works perfect.
As well, if I use a different lock screen (tried with PowerAmp) it works flawlessly.
So can anyone help me understand why this is screwing up and how to fix the orientation whenever this happens?
I can avoid this by avoiding the lock screen through a flag (window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)) but I don't have any other reason to avoid a lock screen and would like to know what is happening.
This sound like a problem that is unique to the S2. Have you tried your app on the emulator or any other devices. It may just be that the S2 implements some part of android incorrectly.
To handle the orientation problem in your application try to use this for your activity like this
<activity android:configchanges="orientation|keyboardHidden" />
in your Android Manfiest file.

Android application autorotates to landscape mode for a few seconds even when portrait mode is locked

I don't know if any of you have seen this before:
I have an application which has the Portrait orientation locked for every activity. However, in the HTC Pro Touch phone (and maybe this happens on other phones with physical keyboards) the application rotates to landscape mode for a few seconds and then returns to portait mode, that happens while navigating on the app. Of course this shouldn't happen but I'm not sure why it does that.
I am locking the portrait mode by calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) in the create method of my super class.
While I was writting this I realized that the locking instruction is called after the super.create(..), could that make a difference? (Testing takes some time if not I would know right now). If not what else could I do to avoid this auto-rotation?
Thanks in advance, I hope someone knows.
You should set the attribute in your manifest.
<activity android:name="bla.blah.bla" android:screenOrientation="landscape" />
Unless you want to change the orientation later. But that is probably the best way to do it.

How can I stop auto screen rotation in my Android app when unlocking the phone from standby

I have an android application that I want to always be running in landscape mode.
I have the following code implemented to keep the app in landscape mode all the time:
inside my activity in the Application Manifest
android:screenOrientation="landscape"
This seems to launch and keep the application in landscape view for the whole duration of the application. Perfect!
However, if I have the app running on my HTC Aria (Android 2.1) and the phone locks, if I unlock the phone, I see the application for probably half a second and it's in portrait orientation and then quickly switches back to landscape mode. It is quite frustrating because all of my views are jumbled around and it looks unprofessional as you can imagine. This happens in both the emulator and on my real phone.
Does anyone know how to stop the application from temporarily rotating when the phone is unlocked?
Additions:
I have tried overriding onConfigurationChanged() but with no success.
I have also tried putting setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); into the onResume() but the app still shows as the incorrect orientation for a split second when the phone is unlocked.
Try setting the orientation in the manifest file. it might just work.
After looking at many other apps that are made for landscape orientation only, I can see that their apps don't freeze their orientation after standby either. I have a feeling that this is a limitation of the phone, and that all apps will switch to a portrait orientation when the phone is locked. If all apps have this "problem" then I think it is acceptable not to fix.
Please post if you have found out there is a way to stop the forced portrait orientation.
the app still shows as the incorrect orientation for a split second when the phone is unlocked.
Did you move setContentView(R.layout.main) to the onResume, AFTER where you put your orientation code? I would try setting the orientation, then the setContentView()

Categories

Resources