How does the lifecycle of a Fragment differ from that of an Activity, and how do you handle configuration changes?