Android :: Switching From Landscape To Portrait Orientation
Apr 3, 2009I want to display a table which would fit better in portrait view than in the landscape view. How do i instruct the emulator to change the orientation?
View 4 RepliesI want to display a table which would fit better in portrait view than in the landscape view. How do i instruct the emulator to change the orientation?
View 4 RepliesHow did you support both landscape and portrait for appwidget? the layout of appwidget will never change when orientate the device from landscape to portrait. by the way, would you please tell me which device support both landscape and portrait for appwidget?
View 1 Replies View RelatedI'm trying to detect landscape vs portrait orientation with the following:
public void onSensorChanged(SensorEvent event) { float pitch = event.values[2];
if (pitch <= 45 && pitch >= -45) { // portrait }
else if (pitch < -45) { // landscape }
else if (pitch > 45) { // landscape } }
Anyone have something more robust? It works pretty well, except if the phone is in a landscape orientation and the user starts to 'flatten' it out, starts thinking it's in the portrait orientation again.
I have written a small example which displays the photos from the server. Its working fine when the device is in one of the mode (landscape of potrait). But if I switch to landscape to potrait or potrait to landscape while downloading the photos from the server, I am getting NullPointerException, showing with androidRunTimeException.
I am using LinearLayout -> ImageView
I am using threads to download the images.
As u know, since android 1.6, there are not dirs on dirs like HVGA-L. Instead, there is only one dir like HVGA. That is, HVGA-P and HVGA-L are merged into one dir, HVGA. So, only HVGA can be selected and by default the emulator is started with portrait mode. Though I can press CTRL+F11/F12 to switch it to landscape mode, I do not like it. What I want is to start the emulator with default mode of landscape. Would anyone know how to do it?
View 3 Replies View RelatedWhile working on orientation change I have found that the onConfigurationChanged is not getting called when changing the orientation from portrait to landscape.But when I am changing from landscape to portrait the method is getting called. Is it the correct behavior because the onConfigurationChanged should by called whenever we are changing the orientation. (android:configChanges="orientation")? I have also found one strange behavior or error, When we are changing from portrait to landscape orientation the string value is displayed correctly(automatically by android system) but when in am changing the orientation from landscape to portrait the same string is displayed(i.e the string in landscape mode).The expected behavior is the string id specified in the portrait mode should be displayed.Is it an platform bug or something wrong in my code/programming.
View 2 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've racked my brain for hours over this issue. I have created a main.xml and designed one for the res/layout-land (landscape) format and another one for portrait in res/layout. When I rotate the emulator (ctrl-F11), my app rotates properly to landscape using the correct main.xml, but a subsequent rotation back to portrait just keeps the landscape mail.xml. This was done in a 2.0 AVD.. Out of desperation I downloaded the new Sample Code for Multiple Resolutions and had to create a new 2.1 AVD, to my surprise rotation with this app works correctly as expected. So I then decided to try my app on the 2.1 AVD and it works perfectly. So, is this a Bug in a 2.0 AVD or is there something special I need to be doing for < 2.1 SDK versions?
View 4 Replies View RelatedHow can I check if the Android phone is in Landscape or Portrait?
View 3 Replies View RelatedHow do we change emulator screen orientation to landscape or portrait?
View 2 Replies View RelatedI am using Intents to switch between activities in my Android app. I am putting data in the Intent for use in the next activity. When I switch the phone between landscape and portrait modes, the values passed from the intent are lost and I get a NullPointerException.
Can someone please tell me what could be wrong.
There's a lot of code to post it entirely. But if someone needs to look at specific parts of code, I can post it here.
Edit
I solved the issue of state not being saved. But another problem I faced is that none of the buttons on the screen work after the orientation has been changed. On button press, I get this warning in LogCat
02-25 23:07:49.190: WARN/WindowManager(58): No window to dispatch pointer action 0
This is getting called in on Create(), how can I speed up orientation switching? private void setupChartView(int position){
Quote my Quote = quotes Adapter.get Item(position);
this.symbol = my Quote.get Symbol();
String url = "http://chart.finance.yahoo.com/z?s=" + symbol + "&t=1d&q=l&l=on&z=l&p=s&a=v&p=s&Lang=en-US®ion=US";
if(chartImageView != null)
imageDownloader.download(url, chartImageView);
if(chartImageViewLandscape != null)
imageDownloader.download(url, chartImageViewLandscape);}
Is there a screen orientation lock feature? I haven't seen it mentioned. In fact a search only turned up mention of it as a hardware button on the iPad. This would be great for using it while lying down, reclining, in the car.
View 2 Replies View RelatedI have a (hopefully) a relatively simple question. How do I tell Android which layout to use for portrait and which layout to use for landscape orientation on my App Widget?
View 1 Replies View RelatedI know if you change a android phone from portrait to landscape sometimes the app relays its self out on the screen.. so how do I simulate rotating a phone with the AVD? On the Blackberry emulators there's a button in the menu to turn the phone, but I can't find it or any option on the Android ones?
View 1 Replies View RelatedI would like to restrict my application which uses Tabs to portrait orientation. I have 4 tabs and I set the "android:configChanges="orientation" for all 4 tabs but the orientation still changes when I rotate the phone. Seem pretty straight forward. Am I missing something?
View 1 Replies View RelatedFor changing from portrait to landscape mode i have done some changes in manifest.xml and included some code in test.java file
In manifest.xml i have included <activity_name android:configChanges="orientation"/>
i entered some data in portrait mode. but when i rotate my mobile from portrait to landscape the control goes to onConfigurationChanged() method.
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setContentView(R.layout.screen1_landscape);
}
When we try to implement orientation in AP layer, we can set "android:screenOrientation" parameter in AndroidManifest.xml file or call "setRequestOrientation()" method of Activity class. But if I want to porting android in new HW device, how can I do? Do I need to modify the graphic driver, or just add configuration in program. (Actually I do some experiments but my AP cannot rotate) Besides, can every experts tell me when I set the "android:screenOrientation" parameter, which process will read this configuration, pass to where and which process will do the rotation?
View 2 Replies View RelatedI've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. How do I specify for each activity which xml file is it's portrait layout and which is the Landscape layout? Is it also possible to specify different layouts for different screen sizes? If so, how is this done?
View 2 Replies View RelatedHow to add rotation effect when change mode portrait to landscape? I want to make it smooth.
View 2 Replies View RelatedI made an app thats use the camera. The first problem i get was that i can't use portrait preview without the rotation 90º image. I used the solution (landscape for all), but now, only in the real device, when i start the app and i have the device in portrait mode it crashes (need to force close) and only after reboot the phone its possible to connect to camera, even in the camera app.
View 2 Replies View RelatedSince the FROYO update some stuff is only in Lanscape and it's what I would call upside down. Is there a fix for that? Like Gmail and internet and some others I noticed. Other than that it's smokin fast and everything is working fine for me.
View 16 Replies View RelatedWhen I record video by MediaRecorder, it always records in landscape mode, regardless of real device orientation. How to force MediaRecorder/Camera use real orientation ?
View 1 Replies View RelatedDoes anybody know how to rotate whole system screen from landscape to portrait?The platform is not G1 or any other phones, it's just a normal ARM platform.Not only one application but whole system.
View 1 Replies View RelatedI like to use Swype in portrait mode but the Android keyboard in landscape mode. Is there an app to auto-switch the keyboard based on the orientation of the phone?
View 13 Replies View RelatedI have an app that I started in 1.6. It used images that were specific to portrait and landscape layouts. I put these in the corresponding drawable folders, for example:
drawable/image01,png
drawable-land/image01.png
when I created a new project with 2.0 it gave me the following folders. drawable drawable-hdpi drawable-mdpi drawable-lpdi. when I look at the documentation around these folders it all seems very straight forward. I assumed that you were able to create the following folders. drawable-hdpi-land drawable-mdpi-land drawable-lpdi-land
and everything would work as before. The image directory would swap automagically pulling the appropriately laid out image depending on your screen orientation. Unfortunately it does not. The SDK seems to get confused, and if I clean the project, the folders come up as poorly named.
Is there a way to pro grammatically force the screen to change between landscape and portrait mode? I want to allow the user to choose a menu item to rotate the screen, instead of relying on pulling out the keyboard. I am looking for something like activity.change Screen Orientation, but couldn't find such a thing in the API docs.
View 3 Replies View RelatedI am facing a problem when i put a text view on screen in landscape mode it position is fine but when i switch to portrait mode it position is remain fix it not change according to screen resolution.
View 2 Replies View RelatedI am finding that my layouts tend to look great in one orientation but if I change the phone's orientation, things are a mess. For example on one screen I have 6 large buttons that look great in portrait orientation but if the user changes phone orientation, those buttons get cut off in portrait.
Do I need to code two layouts for every screen - one for portrait and one for landscape? That would be such a waste of time.
I want to know the device state programmatically.
I mean whether the device is in portrait mode or in landscape mode by programming (in a class which extends the Activity).