Questions tagged [onconfigurationchanged]
154 questions
1
vote
0 answers
How to continue radio streaming in mediaPlayer after screen Orientation changes?
I am using a simple code to stream a radio from url like this:
player = new MediaPlayer();
try {
player.setDataSource("XYZ.com/streaming link");
player.prepare();
player.setOnPreparedListener(new OnPreparedListener() {
…

Navdroid
- 1,541
- 3
- 25
- 52
1
vote
1 answer
onConfigurationChanged(Configuration newConfig) is not calling
In my application i just overriden the method onConfigurationChanged method as given below
@Override
public void onConfigurationChanged(Configuration newConfig) {
System.out.println("Configuration Changed");
Configuration c =…

Kamalone
- 4,045
- 5
- 40
- 64
1
vote
1 answer
Replaced fragment lost after orientation change Android
I have an activity which loads a fragment (say Fragment1) in onCreate. When the user presses a button in Fragment1, I replace Fragment1 with a new fragment, say Fragment2. The problem is that on changing orientation while in Fragment2, the activity…

nimmi
- 95
- 1
- 7
1
vote
2 answers
Manage orientation change in my project
I am working on application with bluetooth connectivity.I have placed my bluetooth enabler (intent) code in onCreate() of my activity. When orientation of the phone changes my phone is trying to reconnect the device. I have tried to handle…

Pratik
- 831
- 2
- 8
- 13
1
vote
4 answers
using both layout-land and onConfigurationChanged()
I just want to change Layout when the device has been rotated. but I've found that onConfigurationChanged() must call onCreate() again using setContentView with separated
layout named of *_land.xml…

joe
- 81
- 1
- 7
1
vote
0 answers
Weird orientation changes on Honeycomb between activities
I have an app which has an activity A, that lets the user click on a thumbnail and go to another activity B which shows the thumbnail full screen. On activity B, if the user clicks anywhere on the screen, it closes the activity.
Both activities are…

android developer
- 114,585
- 152
- 739
- 1,270
1
vote
1 answer
layout-land is not working?
I did some researches about this question but I couldn't find my answer. So, yes I did create a folder under res called "layout-land" and I put a separate main.xml in it. I intentionally deleted some images in the main.xml in the layout-land and I…

Manto
- 1,069
- 2
- 15
- 34
0
votes
1 answer
A better way to handle Activity restart on orientation change?
There is an activity which should not exist when a user leaves it. That's why it has finish() method in the onStop.
@Override
protected void onStop() {
super.onStop();
finish();
}
However, this makes it restart each time the screen…

sandalone
- 41,141
- 63
- 222
- 338
0
votes
1 answer
Android onConfigurationChanged is not being called
I know this question was asked before, but the answer didn't work for me.
So, i want to change somthing in my application when the softkeyboard pop-up.
this is my code.
i'm not trying to do anything interesting, just to see that…

user958880
- 487
- 1
- 7
- 18
0
votes
1 answer
VideoView playback on orientation change problen
I have VideoView (with streaming online video) and I wanted it to continue playing while changing orientation, so I looked around at SO and found that you need to handle orientation change yourself, well ok, I added…

Sver
- 3,349
- 6
- 32
- 53
0
votes
1 answer
Calling ActionMode finish() in onConfigurationChanged() can lead to redraws
I have an ActionMode in my fragment that I want only to run in the portrait mode; so I called actionMode.finish() in the onConfigurationChanged() fragment callback to stop the ActionMode if the orientation in the landscape:
override fun…

user21928976
- 11
- 3
0
votes
1 answer
Android UI Doubles after Configuration Change
I have an issue where the UI of a fragment doubles after a configuration change such that changing from light mode to dark mode and then scrolling down on the fragment's scroll view produces the image below. The UI will hover over each other…

Gil Ong
- 67
- 1
- 6
0
votes
1 answer
"IllegalArgumentException: ID does not reference a View inside this Activity exception" when calling findNavController(activity, id) in onViewCreated
I'm getting an IllegalArgumentException with the message "ID does not reference a View inside this Activity" when calling findNavController(requireActivity(), R.id.mainNavHostFragment) inside the onViewCreated() method of a Fragment. The Fragment is…

Andrew
- 2,438
- 1
- 22
- 35
0
votes
0 answers
Android system theme DarkMode/LightMode change call back at run time
I want to get the current theme of the app and I am doing it as shown below,
when (this.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK)) {
Configuration.UI_MODE_NIGHT_YES -> onThemeChange(Themes.DARK)
…

hasan_shaikh
- 1,434
- 1
- 15
- 38
0
votes
0 answers
With a change of configuration, the fragments are not redesigned
When there is a configuration change, such as uiMode, Locale, etc., the fragments are not restored correctly. Then simply put the application in the background, and then return to the foreground, and everything is restored.
The problem does not…