Questions tagged [onconfigurationchanged]

154 questions
6
votes
4 answers

How to re-adjust views according to new configuration change?

Background I have an app (here) that has Admob banners in it, and I don't like the fact that the banners get re-loaded every time I change orientation, so for a long time I had the same workaround for this, to avoid re-creation of the Activity, and…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
5
votes
1 answer

Android navigation component resets to start destination after configuration change

I am using the Android navigation component and I have an activity with three fragments if I am in the second fragment and rotate the screen forcing the activity to restart the navigation is returned to the start destination. shouldn't the…
5
votes
5 answers

Handling activity rotating in Android

I need to apply different layouts for portrait and landscape orientations of my activity. Besides, I need to show alert if orientation is portrait. I have specified android:configChanges="orientation|keyboardHidden" in AndroidManifest. I also…
darja
  • 4,985
  • 9
  • 33
  • 47
5
votes
1 answer

Conditional restart on Activity onConfigurationChanged

I want to make an activity that allows orientation changes on some condition, but not otherwise. More exactly I want to prevent restarting the activity when a background thread is busy. I have put the configChanges attribute on the activity…
5
votes
3 answers

Android: Width and Height of View After Orientation Change

I need to get the width and height of a WebView and pass them in the query string of the URL I am loading in the WebView. I have found a way to do this in onResume(). Since the width and height are not calculated at this point, I post a Runnable to…
4
votes
1 answer

Resources$NotFoundException after configuration change in dynamic feature module

I'm currently experimenting with dynamic feature modules and came across a strange problem. I handle configuration changes by implementing the onConfigurationChanged method in my Activity and defining it in the manifest by adding…
4
votes
1 answer

How to detect screen rotation on Android in Kivy?

I have been searching for a Kivy solution to capture the Android device rotation from one orientation to another. I have tried both of the window methods below but neither executes the on_rotate or rotate_screen routines when I rotate the device. I…
4
votes
1 answer

How to know which configuration has been changed on an Activity?

onConfigurationChanged method get called on an Activity by the system when there is(are) any changes in the configuration. This method only get called for those configurations which are defined in the manifest by the configChanges attribute. I have…
Tapas Bose
  • 28,796
  • 74
  • 215
  • 331
4
votes
2 answers

How to update layout after onConfigurationChange?

I am building my first app and am almost done. (yay!) Now all I have to do is to set up the Java for the onConfigurationChange used when the orientation is changed as well as the keyboard is pulled out. First off, the problem is that when the…
Dan
  • 61
  • 2
  • 4
4
votes
1 answer

Android VideoView orientation like Youtube app

I'm trying to replicate in my app what the Youtube app does when playing a video. Portrait mode: Shows the video using only 40% of the screen and the rest with information about the video. Landscape mode: Shows the video and the window in fullscreen…
3
votes
4 answers

onConfigurationChanged is not being called the first time I return from another activity

I have the following problem: I have an image that I want to disappear when I change my phone from portrait to landscape. It works perfectly fine when I am on the current activity and I move orientations. It also works completely fine if I go to…
3
votes
1 answer

How can I make an Android Gallery redraw when a View changes?

I am modifying an Activity to implement onConfigurationChanged(...) and it contains a extended Gallery whose members are sized manually using their LayoutParams from the Gallery's adapter. Unfortunately the Gallery initially displays wrong: the…
Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96
3
votes
1 answer

how to handle view rotations like youtube do on android?

I want to achieve the way youtube handles its video orientation. There are a few things to have in mind before just saying that I have to use onConfigurationChanged. THINGS TO CONSIDER The phone orientation. This means the way you hold de phone.…
3
votes
3 answers

Android Rotation Problem with onConfigurationChanged

I gave android:configChanges="orientation|keyboard" to my activity in manifest and when I rotate my device, onConfigurationChanged is always called. No problem with it. What I want is when device is rotated, font size of widget become…
3
votes
2 answers

layout-land xml files does not work with onConfigurationChanged call back

I have different layouts for portrait and landscape mode and I also need to override the onConfigurationChanged() callback. But problem is when I change the phone orientation to landscape my landscape layout does not work. Can anybody tell me is…
sajjoo
  • 6,576
  • 20
  • 65
  • 86
1
2
3
10 11