Used Fragment to Handle config change

I wrote this on the github editor to demonstrate and answer to http://stackoverflow.com/q/3821423/435706 similar to the answer http://stackoverflow.com/a/3821998/435706