When I create a RelativeLayout(or a Button, textview etc) in Android programmatically:
val rl: RelativeLayout = RelativeLayout (this)
Now, can there be a scenario when the OS is not able to allocate any memory to create the RelativeLayout? If yes then How to handle it?
In the documentation, it is not mentioned anywhere if it will return null in this scenario (which I think it won't as rl is non-nullable and the above code doesn't give any compilation error) or if it will give an OutOfMemoryError exception and I have to use a try-catch to handle it.
Is this behavior documented anywhere?