This post will be about an interesting observation I made when working on a custom View that did not extend
EditText, but contained one.
One of the new features introduced in Java 7 was the possibility to handle multiple exception types in a single catch block.
However, in Android, there is a special case where multi-catch can bring trouble for the developers.
I knew that I would write a post about this phenomenon as soon as I met it.
Here is the story: during my work, I was assigned to fix a bug. The bug was the following: when navigating to a certain screen, the application crashed with ClassCastException saying that I cannot cast Linearlayout to FrameLayout.
I checked the layout file that was inflated, and the root element was indeed FrameLayout, making the error seem impossible. But then… what was wrong?