Android :: How To Get Current Screen Orientation
Jul 2, 2010I simply want to do code...
The problem is - getRequestedOrientation always returns -1. Any suggestions?
I simply want to do code...
The problem is - getRequestedOrientation always returns -1. Any suggestions?
is it possible to manually rotate the screen or fix the current screen orientation (with a key/button)? because it really annoys me having taken portrait pictures that cannot be viewed (with the media gallery application) in a portrait fashion on the milestone. this is because it always rotates the portrait picture back to landscape when rotating the milestone from landscape to portrait. right now there is no way of properly viewing portrait pictures on the milestone other than tilting your head (holding the milestone landscape and tilting your head along).this cannot be the way it was intended to be, right? or do I have to get a different viewing software which allows you to choose screen orientation? is there such an app?
View 1 Replies View RelatedHow do i find the current orientation of the phone (portrait or landscape) How do i find the slider position?
View 2 Replies View RelatedThe default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.
You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options
Is it possible to check the screen orientation (I mean whether the screen in landscape or portrait mode) while the outgoing call is going on.If it possible please suggest me how to achieve that.
View 2 Replies View RelatedHow do I go to previous screen from current screen in Android app? I know there is a back button on phone, but it takes me to beginning screen of my app and I want my buttons on app to work for going back to previous screen.
View 1 Replies View RelatedI would a Tab (in a TabHost) to have a Landscape orientation while the activity with the TabHost is in Portrait orientation, is that possible (if so how)? I tried setting the orientation of the Activity displayed in the tab in the Manifest but it didn't work.
View 7 Replies View RelatedI was wondering if there was any java code that will allow you to make sure each window in your app stays in portrait despite the user flipping the phone to landscape. I already tried inserting android:screenOrientation="portrait" into both my android manifest and into every single XML file I had but unfortunately only some stayed in portrait and others still flipped to landscape.
View 3 Replies View RelatedI notice when using the emulator that when the screen is flipped, I get a following logcat message:
INFO/WindowManager(589): onOrientationChanged, rotation changed to 1
How can I catch this in the code? I want to know whenever the orientation changes. I assume I have to set a listener, but I can't find an example anywhere.
I am making an Android app which is currently coming along nicely - I've hit upon a couple of stumbling blocks.
1) How do I stop the screen from going dim/off and the phone locking while the application is running?
2) Can I force the phone to enter landscape mode on running my application?
My project is working fine when i hold my HTC device vertical.But the moment i rotate my screen 90degrees , it throws a force close error.Starts all over again, runs fine until i again change the orientation.How do i handle it ?
View 1 Replies View RelatedI have a series of live wallpapers out and one major sticking point I have with a certain set is that when devices switch to Landscape, the wallpaper, which in most cases is an image designed to fit the screen in portrait mode, appears off center. What is the conventional way to detect the shift from portrait to landscape?
View 2 Replies View RelatedIn the following sequence of events:
1. Start a new thread (as a result of a button click - or similar).
2. User changes the screen orientation (causing the Activity that started the thread to be destroyed).
3. Thread finishes, and wants to do some dialog (or any UI) work. However, doing a showDialog, dismissDialog, ... will crash, as the thread it still referring to the old Activity.
This can be solved by updating the data in the thread to refer to the new Activity upon a screen orientation change.
However, couldn't the Android framework just forward any requests from a destroyed activity, to the newly created Activity, saving us developers of handling it ourselves?
I know on screen orientation changes activity restarted, but suppose i don't want to restart the activity then what should I do? I had tried it by adding in manifest.xml. android:configChanges="keyboardHidden|orientation"
and override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); }
But still activity restarted each time when I change screen orientation.
Please tell me how i can stop the change in orientation of application when device rotate. How i can control the accelerometer.
View 5 Replies View RelatedI get an OutOfMemoryError every time i change the screen orientation and I am having a hard time finding the mistake...
The Activitie's view consists of an ImageView, two Buttons and a Spinner. I don't have static variables and can't imagine where i could leak a context.
Most of the times, the exception is thrown at setContentView (R.layout.upload); sometimes it goes fine until imgUpload.setImageURI(imageURI);
The images i am displaying are form the G1's camera, so about 500kb and 2048x1536pixels
Here is some code:
CODE:..................
Is there any way for an Android application to retrieve some sort of Collection object that contains references to all of the GUI elements which are currently on the phone's screen? This could be very useful for testing purposes and so on. If I have overlooked a well-known class or library, please let me know.
View 3 Replies View RelatedI snap a photo, and it gets placed onto an ImageView. When the user sees the page where the Image View is, and I turn the phone sideways where the orientation is horizontal, the app immediately returns to the app's main screen.
View 1 Replies View RelatedWe currently use Activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_x) to set (and 'freeze') the orientation of our app. Froyo now supports two landscape modes tho and we'd like to allow our users to orient the app to 'landscape right' ... ie, the orientation obtained by turning a device naturally oriented to Portrait 90 degrees clock wise.
View 3 Replies View RelatedI want my Activity to be always in portrait mode and I do NOT want the onDestroy() method to be called. There are some interesting articles about that at: http://www.androidguys.com/2008/11/24/rotational-forces-part-four/
The solution seems to be: In AndroidManifest.xml:
CODE:...............
I've tried it and it seems to work. Is there any other alternative or is it the correct solution?
Specifically, I need a way of _not_ performing the onPause functionality I've implemented when it occurs because of a change in screen orientation.
View 9 Replies View RelatedI am trying to display an image from a URL, which may be larger than the screen dimensions. I have it kind of working, but I would like it to scale to fit the screen, and I also have problems when the screen orientation changes. The image is tiny, and I would like it to scale its width to the screen as well. (In both cases, I would like the image to fill the screen width with scrollbars (if necessary for height).
Here is my ImageView:
CODE:..............
Here is the java code which loads the image: (some error handling code removed for simplicity)
CODE:.........
I have tried different settings for android:scaleType. I'm sorry if this question has been asked before. I've gone through a number of tutorials on the subject, but they don't seem to work for me. Not sure if it has anything to do with the way the image is loaded. (from the web instead of a local resource)
Another issue is that sometimes the image doesn't even load. There are no runtime errors, I just get nothing in the ImageView.
Finally I've been waiting for something like this. Swype - portrait; stock - landscape.Assign Keyboards Based on Orientation - Keyboard Manager for Android | xda-developers
View 2 Replies View RelatedFrom reading Romain Guy's blog post, I understand keep static reference to a Drawable can create huge memory leaks. So what is the recommended solution if I don't want to reload my big Drawable image every time screen orientation changes and effect on performance? Currently my app takes >3 seconds to complete each orientation change.
View 8 Replies View RelatedI want to change the screen orientation from portrait to Landscape and vice-versa when the user shakes his/her android mobile phone, can any one help how to achieve this, because I do not know what event is fired, at the time his/her shaking thier android mobile phone. For Instance When the users touch the button in UI, touch event is fired, similarly when the user shakes his android mobile phone, what is fired.
View 3 Replies View RelatedI am working on a game for android at the moment, and was wondering how i would change the screen depending on orientation.
So if the user turned the phone horizontally then the app would be viewed horizontally if you know what i mean
Also how would i make a timer, so if a button were pressed, how would i say stop for 2 seconds and then go to link?
I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.
Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).
After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?
I have an intent open my phone; when something comes from the server from another Java class I want to refresh the current screen. how I can refresh my current screen without creating a new one?
View 1 Replies View RelatedI have some code in place that checks for if the screen has been re orientated which works fine.But its what I do after that that seems to be a pain.if I put an if statment in that stops any methods that would normally be trigged on the oncreate method my screen is empty on rotation.if I try to just reinflate the view, that doesn't work because I havent saved the data that it displays to singleton.
It basically seems like I have to save my individual vars to a singleton then if the screen reorientates use them... But then that seems really crude and crappy stuff like if you scroll down the viewlist the position is refreshed to the top when you reorienate..What Im doing basically just doesnt seem right?
I am writing a home screen widget and want to update (modify) the home screen widget when the device orientation changes from portrait to landscape or the other way. How can I make it? Currently, I tried to register to CONFIGURATION_CHANGED action like the code below ...
View 3 Replies View Related