Questions tagged [orientation-changes]

In mobile devices there are different orientations (typically, portrait and landscape). Detecting the orientation change will help apps to resize their contents or relayout their UI elements.

In mobile devices there are different orientations (typically, portrait and landscape). Detecting the orientation change will help apps to resize their contents or relayout their UI elements.

307 questions
173
votes
24 answers

How to detect orientation change?

I am using Swift and I want to be able to load a UIViewController when I rotate to landscape, can anyone point me in the right direction? I Can't find anything online and a little bit confused by the documentation.
David
  • 7,395
  • 5
  • 29
  • 45
49
votes
13 answers

Mobile viewport height after orientation change

I am attaching a listener to the orientationchange event: window.addEventListener('orientationchange', function () { console.log(window.innerHeight); }); I need to get the height of the document after the orientationchange. However, the event…
Dan Kanze
  • 18,485
  • 28
  • 81
  • 134
32
votes
7 answers

Get phone orientation but fix screen orientation to portrait

I want to get the phone orientation but keep the screen orientation to portrait. So no matter the user turns the phone to landscape or portrait, the view stays the same, but I can get whether it is turned to landscape or portrait. Setting the…
Arman
  • 875
  • 2
  • 8
  • 30
25
votes
6 answers

Assigning Fragments to tabs in the ActionBar with different orientations

I have 3 fragments and an activity. I want to enable tabs on the ActionBar and assign a Fragment to each of the 3 tabs. How do I hook that up correctly? ORIGINAL POST I have an app that I'm developing using the Google I/O app as a guide. I've…
Metallicraft
  • 2,211
  • 5
  • 31
  • 52
18
votes
5 answers

DialogFragment callback on orientation change

I'm migrating my dialogs, currently using Activity.showDialog(DIALOG_ID);, to use the DialogFragment system as discussed in the android reference. There's a question that arose during my development when using callbacks to deliver some event back…
15
votes
4 answers

You must call setGraph() before calling getGraph()

I have bottom Navigation also I'm replaced the tag with FragmentContainerView it gives me error about it does not have a NavController set on, then i was posted this question and fixed the problem, but I got this below error when…
15
votes
3 answers

Duplicate permission request after orientation change

Because the Android SDK 23 gives users the possibility to deny apps access to certain functionalities I wanted to update one of my apps to request permissions as it is described in here:…
14
votes
3 answers

How to stop changing the orientation when a progress bar is spinning in android

I have a Registration screen where user enters all the registration details and when user clicks on the "Register" button i am showing the progress bar(Progress bar begins to spin) and then takes the user to the home screen.If the user rotates the…
androidGuy
  • 5,553
  • 12
  • 39
  • 56
14
votes
2 answers

Setting targetSdkVersion="13" causes Activities to ignore android:configChanges="orientation" flag

It appears that API level 13 has ("silently" as far as I can tell) introduced a change to how android:configChanges attribute is handled. In my particular case, when "targetSdkVersion" in the app manifest is set to "13" any activities that are…
StefanK
  • 2,020
  • 2
  • 14
  • 16
13
votes
1 answer

How to get getIntent() to return null after Activity called with an Intent set

This question was similar to my original question, but I think there is a better way to approach a solution. getIntent returns wrong intent when setIntent is followed by a rotation Basically, in my main Activity, which extends FragmentActivity,…
James Black
  • 41,583
  • 10
  • 86
  • 166
12
votes
3 answers

Is there a non-deprecated method that matches didRotateFromInterfaceOrientation

I'm trying to find a method call I can latch onto once a device's orientation has changed. Is there something identical to didRotateFromInterfaceOrientation that isn't deprecated?
Brandon
  • 2,886
  • 3
  • 29
  • 44
12
votes
3 answers

Window orientationchange event in Angular

Is there a way to call the orientationchange event inside an AngularJS directive? I'm currently working with angular-masonry and I'm trying to update/refresh masonry when the orientation of the mobile device changes. I've found this but I'm…
tdhulster
  • 1,531
  • 3
  • 18
  • 32
12
votes
2 answers

How to set page orientation for Word document?

I use Apache POI XWPF to create and handle MS Word documents. But I didn't find in the documentation how to change the page orientation. Apparently this way should make it: XWPFDocument doc = new XWPFDocument(); CTDocument1 document =…
kapandron
  • 3,546
  • 2
  • 25
  • 38
11
votes
1 answer

Fragment/Activity Lifecycles and Orientation Change

Fragments are funny things but, so I thought, once you know their quirks they're an invaluable tool for writing good code across multiple devices. However, while fixing an orientation change bug I've run up against a wall. For my fragment to work it…
Graeme
  • 25,714
  • 24
  • 124
  • 186
11
votes
2 answers

Fragment's onActivityResult not called after orientation change

Please note, this question is not a duplicate of the following: https://stackoverflow.com/questions/19006776/onactivityresult-not-working-with-fragments onActivityResult not working on fragments Also, another similar question was asked before, but…
Shade
  • 9,936
  • 5
  • 60
  • 85
1
2 3
20 21