But as per this document on android developer site
Handling the configuration change yourself can make it much more difficult to use alternative resources, because the system does not automatically apply them for you. This technique should be considered a last resort when you must avoid restarts due to a configuration change and is not recommended for most applications.
so I also want different layout in both mode(portrait and landscape).
let me explain my use case
I am designing an application which has a blogs Option in navigation drawer.So whethar the device is in landscpae or Portrait or user switch between these two modes ,data that is downloading from server using async task
should be countinue download.and once download is complete it should update blogs layout whethar it is in landscpae or portrait
So what solution I should use
1)Retain an Object during Configuration Change
2)Handling Configuration Changes yourself