Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

[flagged]


I write apps for Android and design devices that run on Android for a living. A friend once asked why I have an iPhone, and my response was pretty simple:

"I'll switch to Android when I can rotate my screen animate the rotation instead of blanking out"

They got it immediately.

-

For those not familiar with Android, your app's UI is completely destroyed on every single configuration change. Rotation. Plugging in a keyboard. Dark mode.

Then the app has to redraw it's entire state from memory in the new orientation.

To do that tiny little thing I described above you'd have to design your app to disable all built in configuration handling (so now it's on you to handle swapping out every resource when a language change happens, or dark mode is turned on) then hand animate every element to its new position on every screen. Needless to say, that's not done.

It was probably very convenient when they were designing the G1 with it's 192MB of RAM, but to me it's a thing that encapsulates everything wrong with Android as a platform for me to use daily.

I wonder what percentage of daily Android crashes in the world are a direct result of this tiny decision. Or god forbid, the amount of gnashing of teeth in how to write Android apps in a "clean" way that manages with this...

(And yes, iOS has state restoration too, but it's strictly for returning from the background, so it's not nearly as intrusive)


I didn't remember how android handles screen rotations so I went and checked, I looked on both my phone and my tablet on a plethora of apps:

- YouTube

- GMail

- FireFox

- Plex

- RIF (Reddit app)

- Material (HackerNews app)

- Main home screen

- Sudoku game

All of them animated screen rotation just fine, with no blank screen or glitching. Just a smooth animation of the app screen rotating from portrait to landscape (and back).

It's possible that your assumptions are outdated and - by your own admission - should switch back to Android.


You realize I work on Android devices all day long right?

I have 5 of them sitting in this room!

You might not notice, but I assure you, they clear the screen then fade back in. The exceptions are apps that have to handle configuration changes anyways like games or full screen video.

It's not always a janky thing, phones have gotten fast enough that the screen redraw is easily hidden behind a half rotate followed by a fade in, but the point is that the hacks are even needed in the first place.

Their approach to configuration changes just adds a massive footgun that trips up plenty of developers. The number of high profile apps with semi-permanent bugs like "I got scrolled back to the wrong part of the page when I rotated my phone!" insane.

A future without that is only coming once we get a replacement for the current UI framework in the form of Flutter or Jetpack Compose (both of which handle configuration changes in new ways)


With limited Android experience I can corroborate the screen rotation stupidity. The latest google wisdom is to use the Model View ViewModel pattern, which can help to work around this issue. If you are using a “view model” its a hack to largely avoid this screen rotation BS, but I don’t expect many Android apps are implemented this way. Keeping up with google is like chasing your own tail.


I haven't written Android code in a few years, but IIRC, there's an attribute you can add to your manifest that lets you handle the rotation without getting your UI getting destroyed and recreated. This is relatively easy to do and seems to be commonly done, at least for bigger apps.

Having worked in both Android and iOS development, I can assure you that they both have some ridiculous quirks and confusing APIs, but you eventually just learn to deal with them.


I already covered that:

> To do that tiny little thing I described above you'd have to design your app to disable all built in configuration handling (so now it's on you to handle swapping out every resource when a language change happens, or dark mode is turned on) then hand animate every element to its new position on every screen.

That's not done in "bigger apps", it's done in apps that have large areas not rendered with normal UI elements, like games, or camera apps

I've done some iOS work too, and while iOS has its issues it "defaults" to making better apps, hands down.

It's not unlike the user side of these platforms, iOS has a more opinionated "default" than Android

Jetpack is trying to fix that but it's "not that much, extremely late"

-

But again, this is all missing the forest for the tree here, configuration changes are just a tiny part of the general "backend" choices that add up to a more powerful platform in developing for Android... but a less useable platform as a user




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: