Android Question Don't re-create activity when change the orientation

Discussion in 'Android Questions' started by Lucas Eduardo, Aug 29, 2019.

  1. Lucas Eduardo

    Lucas Eduardo Member Licensed User

    Hello, i think i did this sometime ago, but i don't remenber. So, there is a code that don't recreate the activity when the orientation is changed?
    I need to do just one activity, not more than this, the solution of create another activty doesn't work to me.

    Thanks :D
     
  2. DonManfred

    DonManfred Expert Licensed User

    Not that i know of. I guess this is how Android works.

    I may be wrong.
     
  3. Lucas Eduardo

    Lucas Eduardo Member Licensed User

    Got it, and do you know another way to keep my panels, CLVs, all views in the same place when i return from changed orientation?
     
  4. DonManfred

    DonManfred Expert Licensed User

    You can set a activity to run only in a specific orientation. This may limit the recreations a bit...

    Code:
    SetActivityAttribute(<ActivityName>,
        android:screenOrientation,
        
    "landscape"
    )
    Replace <ActivityName> with your activityname
     
  5. AnandGupta

    AnandGupta Active Member Licensed User

    I use below

    Code:
    #Region  Project Attributes
        
    #ApplicationLabel: B4A Example
        
    #VersionCode: 1
        
    #VersionName:
        
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: portrait
        
    #CanInstallToExternalStorage: False
    #End Region
    i.e. #SupportedOrientations: portrait

    Regards,

    Anand
     
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