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

  • SEARCH
  • Home
  • 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 9044519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:00:40+00:00 2026-06-16T11:00:40+00:00

I am developing a game (sort of) which uses OpenGL and has background music.

  • 0

I am developing a game (sort of) which uses OpenGL and has background music. Application runs only in landscape mode.

Problem I have, happens when user locks screen. At that point onStop() is called, screen orientation is changed and soon after my Activity is restarted as a result of orientation change. This means OpenGL surface is recreated, music starts playing again and all sorts of other things. This is counter-intuitive as locking screen should suspend CPU intensive operations, not start them.

Adding android:configChanges="orientation" to manifest did nothing. I do realize that I am probably missing screenSize in android:configChanges but I can not add it since I am targeting earlier API versions which do not have this option available.

So, question is: What’s the proper way to handle this? On which event should I initialize my application so that everything works as expected?

  • 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-06-16T11:00:41+00:00Added an answer on June 16, 2026 at 11:00 am

    Adding screenSize to configChanges in manifest doesn’t mean that your program won’t run on older version. You just need to set targetSdkVersion to higher version and minSdkVersion to whatever you like. In intelljIDEA I set ModuleSKD to 4 in Project Structure so it doesn’t highlight screenSize as invalid. It must be similar in Eclipse.

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
    
    <activity android:name=".MyActivity"
          android:label="@string/app_name"
          android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation">
    

    Also you can check the version in code like this:

    if (Build.VERSION.SDK_INT >= 11) 
    

    This way your app work on 2.2 as well as higher versions.

    I think you won’t need onConfigurationChanged because your game probably run only in landscape mode but if your interested have a look at my question very similar to yours and my own answer.

    replace layout on orientation change

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

Sidebar

Related Questions

I developing simple game application in which i playing sound with UIView animation. theAudioPlayer
I'm developing a game in Eclipse CDT in C++/OpenGL, and it compiles and runs
I am developing a game which uses sine wave. I made use of the
I'm developing a game where I update the height the player has already gone.
I am developing a Game in which sprite have to jump forward . I
I am developing game editor in C# that uses c++ lib files. I want
I'm developing the game server, which is written on C. And I need to
I am developing a game that uses a different controller for each level. It
I'm developing a game which is based around the user controlling a ball which
I am currently developing a game which simulates an operating system. Therefore i need

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.