Android - Fragment initialization constructor vs setArguments
One of the few eye openers for new application developers dealing with Fragments is as to how they are initialized. The recommended approach to use Fragment.setArguments might seem a bit too much of a work specially when the constructor is available. Besides, it seems to be error prone too as it could result in a fragment in an uninitialized state. This is even more so obvious for library developers exposing Fragments and application developers missing the prerequisites to use the Fragment (as its not a compile time enforcement). So why would anyone want setArguments? Its easy to adopt an approach once the reasoning is understood. Although, both approach satisfy the initialization requirement, the deal breaker is a use case of orientation change when the activity for most applications is recreated (as long as the developers aren't handling it via onConfigurationChange). In this case, the activity is destroyed and a new instance of the activity is crea...