Solution 1 :
It’s hard to help you without seeing your code. But check that is this line available in your code.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Solution 2 :
Maybe be you don’t activate rotation in the top panel of your simulator.
Problem :
My AndroidManifest.xml does not include anything that would cause this (that I know of).
I.e. it does not include:
android:configChanges=”orientation”
Android Version: Chipmunk 2021.2.1 Patch 1
class MainActivity : AppCompatActivity() {
internal lateinit var tapMeButton: Button
internal lateinit var gameScoreTextView: TextView
internal lateinit var timeLeftTextView: TextView
internal var score: Int = 0
internal var gameStarted = false
internal lateinit var countDownTimer: CountDownTimer
internal val initialCountDown: Long = 5000
internal val countDownInterval: Long = 1000
companion object {
private val TAG = MainActivity::class.java.simpleName
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.d(TAG, "onCreate called. Score is $score")
tapMeButton = findViewById(R.id.tapMeButton)
gameScoreTextView = findViewById(R.id.gameScoreTextView)
timeLeftTextView = findViewById(R.id.timeLeftTextView)
tapMeButton.setOnClickListener { view ->
if (!gameStarted) {
startGame()
}
incrementScore()
}
resetGame()
}
Comments
Comment posted by Gavin Wright
Are you sure you’ve correctly overridden
Comment posted by stackoverflow.com/q/8515936/6892294
See this discussion to understand what is happening here:
Comment posted by mstucki7
I added onCreate() to original post. Thanks!