A QR scanner inside of a Fragment

非 Y 不嫁゛ 提交于 2019-11-30 18:21:59

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!