Android Question Hi there,a quick ???

Discussion in 'Android Questions' started by Lary Yenta, May 6, 2015.

  1. Lary Yenta

    Lary Yenta Member Licensed User

    One of the modules in my project is a graph, how can I "force" the graph into landscape mode? I have been looking but I can't find it anywhere.

    Thanks in advance,

    lary
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    DonManfred likes this.
  3. DonManfred

    DonManfred Expert Licensed User

    To do it by code @eurojam already told you how.
    But you can also do it with the manifesteditor

    Add one line for each activity you want to run in a specific orientation
    Code:
    SetActivityAttribute(orderdetails,android:screenOrientation, "sensorLandscape")
    replace the orderdetails with the activityname
     
    walterf25 likes this.
  4. Lary Yenta

    Lary Yenta Member Licensed User

    Hey eurojam and DonManfred,

    I used the manifest method with no issues at all, Thanks guys!!!!

    Lary
     
  5. gz7tnn

    gz7tnn Member Licensed User

    I realize this is a older post but I have tried the Manifest approach to force screen orientation to sensorLandscape but my app will not "compile and run".
    It does a Test Compile without any problem.
    I am on B4A V2.71 with Core 2.71 and using Phone lib 2.10

    When I add the following to the Manifest:
    SetActivityAttribute(Main,android:screenOrientation, "sensorLandscape")

    I get the following error when compiling:
    Parsing code. 0.02
    Compiling code. 0.13
    Compiling layouts code. 0.00
    Generating R File. Error
    AndroidManifest.xml:17: error: Error: String types Not allowed (at 'screenOrientation' with value 'sensorLandscape').

    I can however obtain the correct sensor landscape rotation by using the following command immediately after the activity.loadlayout.
    phone1.SetScreenOrientation(6)

    Attached is a small example with the Manifest entry that fails.
    Because the phone1.SetScreenOrientation(6) approach works it is not a great issue, but reading post #3 it seems the Manifest approach allows a single place to define multiple activity orientation - which may be useful at some stage.

    {Sorry - the layout is designed for 7" tablet so will not look too good on a smaller screen}
     

    Attached Files:

    Last edited: Oct 27, 2015
  6. eurojam

    eurojam Well-Known Member Licensed User

    you should change the minSDK Version in the manifest to minSdkVersion="9"
     
  7. gz7tnn

    gz7tnn Member Licensed User

    Thanks for quick reply. I tried that and still no luck.
    Does the minSDK version translate to meaning that I need to have the Android 2.3.1 (API 9) SDK platform installed?
    If so then I don't have that one, and when I tried to install it I see it is obsolete.
    I tried setting the minSDK to 10 and 11 but no luck there.

    Excuse my ignorance in this area, so may not be understanding what this means.
    Will need to try again tomorrow.
     
  8. eurojam

    eurojam Well-Known Member Licensed User

    that is strange, with b4a 5.2 it works as it is...no problems so far
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice