I have an activity that I would like to be able to rotate 180 degrees. This is for a game for two people where if the players want to 'switch sides' they can hit a rotate button to go from portrait to reverse portrait and back..
I found this java code which looks like the right place.
mainActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
I would like it to work like in this manner but I'm not sure the best way to do this in Kotlin.
rotate_button.setOnClickListener{
reverseOrientation(PORTRAIT or REVERSE_PORTRAIT)
}
Any recommendations on how to implement? Thank you.
Setting the views 'rotation' in the XML via Kotlin is working well.