Android action bar tabs with fragments having separate back stack for each tab

 Программирование  android

It took me three days to solve the issue of overlapping fragments, lost history and failure to display fragments after device rotation. There are a lot of discussions on these subjects on StackOverflow none of them providing a good working solution. At last I have found a good answer describing the general approach. I've strictly followed the advice and got the working solution which I want now to share with the rest. I have created a Gist containing all necessary code.