Common Orientation Change Bugs in Travel Apps: Causes and Fixes
Travel apps combine native Android activities, fragments, and WebView components with complex data flows such as booking, payment, and itinerary display. Orientation changes trigger Android’s configur
What causes orientation change bugs in travel apps (technical root causes)
Travel apps combine native Android activities, fragments, and WebView components with complex data flows such as booking, payment, and itinerary display. Orientation changes trigger Android’s configuration‑change handling. If the activity does not declare android:configChanges or uses fragments without proper state management, the system destroys and recreates the view hierarchy. Common culprits:
- Missing
android:configChanges– the framework restarts the activity, wiping out unsaved form data. - Fragment lifecycle mismatches – a fragment may be re‑attached after a screen rotation, losing its arguments or back‑stack.
- Third‑party SDK orientation locking – map SDKs or payment widgets sometimes force portrait mode, leaving the rest of the UI misaligned.
- WebView without proper viewport – rotating a device changes the viewport size; without a correct
the rendered page scrolls horizontally or truncates content. - ViewStub or lazy‑loaded views – these are inflated on first layout; a rotation can prevent the inflation, leaving UI elements missing.
On the web side, CSS media queries that rely on orientation without height fallback can cause layout shifts. JavaScript that re‑initialises components on resize without preserving state leads to data loss.
Real‑world impact (user complaints, store ratings, revenue loss)
When a user rotates a phone while searching for flights, the search results may disappear, the “Book Now” button may become unclickable, or entered passenger details may vanish. Immediate effects:
- Support tickets spike – users flood help desks with “my booking disappeared”.
- App store ratings drop – a single orientation bug can push a 4.5‑star app below the 4.0 threshold, triggering algorithmic penalties.
- Revenue leakage – abandoned carts rise by 12‑18 % in affected sessions, directly impacting conversion rates.
- Brand erosion – travel is time‑sensitive; a broken UI during a last‑minute booking erodes trust and drives users to competitors.
5‑7 specific examples of how orientation change bugs manifests in travel apps
| # | Symptom | Typical root cause | Impact on user flow |
|---|---|---|---|
| 1 | Date picker shifts off screen, input fields cleared | Activity recreation without saving onSaveInstanceState | User must re‑select dates, increasing friction |
| 2 | Flight search results grid collapses to a single column, overlapping with header | CSS flex container without flex-wrap and missing viewport meta | Search becomes unusable, users abandon |
| 3 | Payment form fields lose focus, keyboard disappears mid‑entry | EditText not handling onConfigurationChanged | Card details lost, checkout fails |
| 4 | Map view shows a blank placeholder while pins disappear | Map SDK orientation lock + Activity restart | Users cannot locate destinations, booking stalls |
| 5 | Filter pane collapses behind the toolbar, buttons become unreachable | Nested LinearLayout with fixed height, no layout_height="wrap_content" | Filtering impossible, users resort to external search |
| 6 | Error messages overlay UI elements, obscuring buttons | Snackbar or Toast positioned with absolute coordinates ignoring safe insets | Users cannot dismiss errors, leading to retry loops |
| 7 | Deep‑link navigation lands on wrong screen after rotation | Intent handling in activity not preserving savedInstanceState across config change | User ends up on home page instead of targeted itinerary |
How to detect orientation change bugs (tools, techniques, what to look for)
- Manual rotation testing – Use an Android Emulator or physical device, rotate while recording UI state. Look for
ANRdialogs,NullPointerExceptionin logs, or UI elements disappearing. - Automated UI testing – Write a script that programmatically rotates the screen (
adb shell input keyevent 23on Android,Ctrl+Shift+Min Chrome DevTools). Capture screenshots before/after and compare pixel differences. - SUSA autonomous exploration – Upload the travel app APK or web URL. SUSA runs 10 persona‑driven test suites (curious, impatient, elderly, adversarial, novice, student, teenager, business, accessibility, power user). During each session it triggers orientation changes, records crashes, ANRs, dead buttons, and accessibility violations. The platform’s flow tracking logs each PASS/FAIL verdict for login, registration, checkout, and search, highlighting orientation‑related failures.
- Static analysis – Use lint rules that flag missing
android:configChangesorandroid:windowSoftInputModemisconfigurations. - Runtime monitoring – Instrument with
ViewTreeObserverlisteners to log layout changes on rotation. Combine with coverage analytics to see which UI elements are never exercised during orientation swaps.
How to fix each example (code-level guidance where applicable)
1. Date picker shift
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable("date", datePicker.getDate());
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
datePicker.updateDate(savedInstanceState.getParcelable("date"));
}
Declare android:configChanges="orientation|screenSize" and keep the fragment alive.
2. Search results grid collapse
Add meta name="viewport" content="width=device-width, initial-scale=1"> and ensure CSS:
.results { display: flex; flex-wrap: wrap; }
.item { flex: 1 0 200px; }
Use box-sizing: border-box to prevent overflow.
3. Payment form focus loss
For each EditText:
android:importantForAutofill="no"
android:imeOptions="actionDone"
Override onConfigurationChanged:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Preserve focus
View focused = getCurrentFocus();
if (focused instanceof EditText) {
((EditText) focused).clearFocus();
}
}
4. Map view blank
Force map SDK to respect orientation:
MapView mapView = findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(canvas -> {
canvas.getUiSettings().setRotateGesturesEnabled(true);
});
Declare android:configChanges="orientation|screenSize" and avoid setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT.
5. Filter pane collapse
Use layout_height="wrap_content" and layout_behavior="@string/appbar_scrolling_view_behavior. Ensure nested scrolls are properly nested:
<androidx.core.widget.NestedScrollView
android:layout_height="wrap_content"
android:layout_matchParentWidth="true"/>
6. Error messages overlay
Position snackbars with CoordinatorLayout and inset handling:
Snackbar.make(root, msg, Snackbar.LENGTH_LONG)
.setAnchorView(R.id.fab)
.show();
Avoid absolute positioning; use layout_gravity or margin based on safe area.
7. Deep‑link navigation
Store deep‑link data in Intent extras and restore in onNewIntent. Use SingleTask launch mode to keep activity alive:
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
handleDeepLink(intent);
}
Prevention: how to catch orientation change bugs before release
- Integrate SUSA into CI/CD – Add a GitHub Action that uploads the latest APK or web bundle, runs the autonomous test suite, and fails the build if any orientation‑related crash, ANR, or UI regression appears. The action can consume JUnit XML reports and post comments on pull requests.
- Enable cross‑session learning – Each SUSA run stores failure patterns. Over multiple releases the platform becomes smarter about your travel app’s orientation handling, flagging recurring issues before they reach production.
- Coverage‑driven testing – Use SUSA’s coverage analytics to generate a list of “untapped elements”. Prioritize those elements for manual rotation tests, ensuring that critical UI components (search bar, payment button, map pins) are exercised in both portrait and landscape.
- Automated rotation pipeline – Set up a CLI agent (
pip install susatest-agent) that runs a script on every PR. The script
Test Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free