The barcodefragmentlib is the one you are looking for. And its wiki shows you how to integrate it (although I used a different way before the wiki comes out).
However after fully integrated it and solve all the issues for our commercial app, I feel like put a QR scanner inside a fragment and switch using ViewPager is not a good idea. Some of the known issues with this idea and the mentioned library to me are:
- Frequently switch between the QR fragment and other fragments will make your app laggy and easy to crash;
- Fragment replacement is not so easy to handle as Activity, QR fragment is even worse;
- Handling portrait/horizontal scan mode is not available by default (related to original ZXing lib)
- When first open the QR fragment, it may black out your screen for a very short time
- Scanner is not working well on Galaxy S4 or other new devices with higher resolution camera/display
Although these issues mentioned above can be solved with certain effort, it is really a trade off.