aspose file tools*
The moose likes Android and the fly likes How to force landscape under all circumstances? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to force landscape under all circumstances?" Watch "How to force landscape under all circumstances?" New topic
Author

How to force landscape under all circumstances?

Ameet Sharma
Greenhorn

Joined: Dec 09, 2009
Posts: 4
Hi. I'm using eclipse... I've set up my manifest file with this android:screenOrientation="landscape"... inside the activity tag...

This works fine if I'm using an HVGA, HVGA-P or a QVGA-P android virtual device... but when I use an HVGA-L device or a QVGA-L device, it doesn't work... if I change the manifest file with screenOrientation="portrait", then it works correctly for these 2 cases...

So how can I get the project to be landscape, under all circumstances. Appreciate any help. Thanks.

-Ameet
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

I think, the definition of "portrait" or "landscape" wouldn't change for different screen configurations. Try putting this in your manifest, if not already, and see if it works:

<supports-screens
android:normalScreens="true"
android:smallScreens="true"
android:largeScreens="true"
/>


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Also, do not remove/change the android:screenOrientation="landscape" attribute from your activity tags.
Ameet Sharma
Greenhorn

Joined: Dec 09, 2009
Posts: 4
Hi Monu. Thanks for the reply. It still doesn't work.

I tried changing the sdk version also... it didn't work. Perhaps the target's OS version is the problem? I have them on 1.5.
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Ameet Sharma wrote:Hi Monu. Thanks for the reply. It still doesn't work.

I tried changing the sdk version also... it didn't work. Perhaps the target's OS version is the problem? I have them on 1.5.


The <supports-screens> tag also has a android:anyDensity attribute which is false by default for API versions < 4 and true for API versions 4 and higher. I tried these settings on 2.0(API level 5; android:minSdkVersion="5") so you could try the following and see if it helps.


Reference: <supports-screen>
Ameet Sharma
Greenhorn

Joined: Dec 09, 2009
Posts: 4
Hi Monu. If I have a target with 1.6 or higher... the HVGA-L option is no longer available...

I guess I'm confused as to how to deal with different devices, vs different OS's...

For example, how do I make sure the app will run the same way on a portrait-style android phone... and a landscape-style android gaming device like this:

http://www.hardkernel.com/products.html

Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

I have only worked with HTC Hero and G1 phone and both have same screen size. I have only "read" about multiple screen supports and what you should do to support different screen sizes.
I guess, what I am trying to say is that I cannot answer your question.

However, I can point to some of the material I think you should read:
  • Support for additional Screen sizes
  • <supports-screens> tag in Manifest
  • Android Manifest: Supporting multiple screen sizes and SDK versions
  • Complications due to Screen Sizes
  • Discussion: Will Android be hurt with different screen sizes
  • Ameet Sharma
    Greenhorn

    Joined: Dec 09, 2009
    Posts: 4
    Monu Tripathi wrote:I have only worked with HTC Hero and G1 phone and both have same screen size. I have only "read" about multiple screen supports and what you should do to support different screen sizes.
    I guess, what I am trying to say is that I cannot answer your question.

    However, I can point to some of the material I think you should read:
  • Support for additional Screen sizes
  • <supports-screens> tag in Manifest
  • Android Manifest: Supporting multiple screen sizes and SDK versions
  • Complications due to Screen Sizes
  • Discussion: Will Android be hurt with different screen sizes


  • Thanks. Appreciate it.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How to force landscape under all circumstances?