android - Zxing using custom layout -
i'm using zxing
library way:
repositories { mavencentral() maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.google.zxing:core:2.2' compile 'com.embarkmobile:zxing-android-minimal:1.2.1@aar' }
and in activity
:
intentintegrator.initiatescan(this); @override protected void onactivityresult(int requestcode, int resultcode, intent data) { intentresult result = intentintegrator.parseactivityresult(requestcode, resultcode, data); if(result != null) { if(result.getcontents() == null) { toast.maketext(this, "cancelled", toast.length_long).show(); } else { toast.maketext(this, "scanned: " + result.getcontents(), toast.length_long).show(); } } else { // important, otherwise result not passed fragment super.onactivityresult(requestcode, resultcode, data); } }
and looks this:
but don't know how add button on camera preview. how can create custom layout camera on background , button on front?
i had problem while borrowed , customised code andreas schildbach bitcoin wallet. create small camera view in screen while have other views.
i put gist here.
its qrcode scanner , there buttons , edittext around it. has overlay rectangle better finding middle of screen.
Comments
Post a Comment