Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6249667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:16:53+00:00 2026-05-24T13:16:53+00:00

I had an application of timer and my app should always be in LandScape

  • 0

I had an application of timer and my app should always be in LandScape mode. I am getting width and Height of my main layout in code. In manifest, I had used:

     <activity android:name=".MActivity"
                      android:label="@string/app_name"
                      android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar"
                android:configChanges="keyboardHidden|orientation">

And in activity :

layout = (LinearLayout)findViewById(R.id.Rishikesh);
        ViewTreeObserver vto = layout.getViewTreeObserver();
        vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

            public void onGlobalLayout() {
                int finalHeight, finalWidth;
                finalHeight = layout.getMeasuredHeight();
                finalWidth = layout.getMeasuredWidth();
                Log.w("*************", "OnGlobalLayoutListener/ Footer height :"+layout.getHeight()+" Width :"+layout.getWidth());


            }
        });

It gives height and width in landscape mode. But when i lock my phone, It gives height and width in portrait mode. What I am doing wrong I don’t know. I am working on ANdroid 2.1. Can anyone help me solving this.

Logs before locking:

08-11 15:19:08.996: INFO/NotificationService(1156): enqueueToast pkg=com.Timer callback=android.app.ITransientNotification$Stub$Proxy@45b190a0 duration=100
08-11 15:19:09.005: WARN/*************(2369): OnGlobalLayoutListener/ Footer height :442 Width :854
08-11 15:19:09.995: INFO/NotificationService(1156): enqueueToast pkg=com.Timer callback=android.app.ITransientNotification$Stub$Proxy@45a6b670 duration=100
08-11 15:19:10.005: WARN/*************(2369): OnGlobalLayoutListener/ Footer height :442 Width :854
08-11 15:19:10.335: DEBUG/dalvikvm(2075): GC freed 6414 objects / 550768 bytes in 212ms
08-11 15:19:10.345: ERROR/webcoreglue(2075): The real object has been deleted
08-11 15:19:10.345: ERROR/webcoreglue(2075): The real object has been deleted
08-11 15:19:10.345: ERROR/webcoreglue(2075): The real object has been deleted
08-11 15:19:10.355: DEBUG/webviewglue(2075): nativeDestroy view: 0xa6bf48
08-11 15:19:10.996: INFO/NotificationService(1156): enqueueToast pkg=com.Timer callback=android.app.ITransientNotification$Stub$Proxy@45a63ed0 duration=100
08-11 15:19:10.996: WARN/*************(2369): OnGlobalLayoutListener/ Footer height :442 Width :854
08-11 15:19:11.995: INFO/NotificationService(1156): enqueueToast pkg=com.Timer callback=android.app.ITransientNotification$Stub$Proxy@45afcbe0 duration=100
08-11 15:19:11.995: WARN/*************(2369): OnGlobalLayoutListener/ Footer height :442 Width :854
08-11 15:19:12.065: DEBUG/WindowManager(1156): I'm tired mEndcallBehavior=0x2
08-11 15:19:12.295: INFO/power(1156): *** set_screen_state 0

LOGS: After locking :

08-11 15:19:12.315: DEBUG/WifiService(1156): ACTION_SCREEN_OFF
08-11 15:19:12.325: DEBUG/SurfaceFlinger(1156): About to give-up screen, flinger = 0x11cf18
08-11 15:19:12.385: DEBUG/ViewFlipper(1369): updateRunning() mVisible=false, mStarted=true, mUserPresent=false, mRunning=false
08-11 15:19:12.585: DEBUG/dalvikvm(1156): GC freed 18364 objects / 926968 bytes in 153ms
08-11 15:19:12.725: INFO/WindowManager(1156): Setting rotation to 0, animFlags=0
08-11 15:19:12.725: INFO/ActivityManager(1156): Start proc com.android.settings for broadcast com.android.settings/.widget.SettingsAppWidgetProvider: pid=2402 uid=1000 gids={3003, 1015, 3002, 3001}
08-11 15:19:12.755: INFO/dalvikvm(2402): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38)
08-11 15:19:12.765: INFO/ActivityManager(1156): Config changed: { scale=1.0 imsi=0/0 loc=en_IN touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34}
08-11 15:19:12.825: WARN/*************(2369): OnGlobalLayoutListener/ Footer height :816 Width :480
08-11 15:19:12.885: INFO/dalvikvm(2402): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=44)
08-11 15:19:12.905: INFO/ActivityManager(1156): Process com.touchnote.android (pid 2382) has died.

Before locking : OnGlobalLayoutListener/ Footer height :442 Width :854
After locking : OnGlobalLayoutListener/ Footer height :816 Width :480

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:16:54+00:00Added an answer on May 24, 2026 at 1:16 pm

    The issue is that your application is not in foreground and other applications may request to allow portrait or only portrait.

    You receive current global layout – which may be portrait. Probably you receive onPause() before screen is locked and onResume() when your application is back in foreground – if you don’t want to get layout when not in background, simply use a bool to store if you’re the foreground app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had an application that hooked onto 1 single database. The app now needs
I had a GUI application with the following layout: wxFrame --> wxBoxSizer --> wxImagePanel
I had an application written without ARC, now I added ARC and I do
We had an application using axis2 1.0. We recently migrated to axis2 1.4. After
I had an application that was downloading a .CSV file from a password-protected website
I had developed an application in which I have to display images from specific
I had developed an application for sending email. On click of email button it
I had a commenting application in my web site. The comments will store in
I recently had my free application published in Mac Appstore. I'm trying to find
If I had a java application that needed specific environment variables to be set,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.