camera - Change QR Scanner orientation with ZXING in Android Studio -


i hope can me this. im using zxing embedded library in order use qr scanner, problem is on landscape mode , change portrait.

i have on dependencies of graddle

compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar' compile 'com.journeyapps:zxing-android-integration:2.0.1@aar' compile 'com.google.zxing:core:3.0.1' 

and have in java class activate scanner button...

public void scanqr(view view){     intentintegrator integrator = new intentintegrator(this);     integrator.setdesiredbarcodeformats(intentintegrator.qr_code_types);     integrator.setresultdisplayduration(0);//text..     integrator.setprompt(" scan qr code");     integrator.setscanningrectangle(450, 450);//size     integrator.setcameraid(0);  // use specific camera of device     integrator.initiatescan();  } 

thanks help!

i using

compile 'com.journeyapps:zxing-android-embedded:3.1.0@aar'

it different version, don't know if work you, working me.

more setup, compile

'com.journeyapps:zxing-android-embedded:3.1.0@aar'

'com.google.zxing:core:3.0.1'

and did not compile

'com.journeyapps:zxing-android-integration:2.0.1@aar'

first created activity extend captureactivity

or click link view class https://gist.github.com/thegratefuldev/21a557c9a96333ec037c

public class captureactivityportrait extends captureactivity { //nothing in side. } 

second, add

integrator.setcaptureactivity(captureactivityportait.class);

into integrator code.

this how mine looks like:

customintegrator integrator = new customintegrator(activity);             integrator.setdesiredbarcodeformats(customintegrator.pdf_417);             integrator.setprompt("scan barcode");             integrator.setcameraid(0);  // use specific camera of device             integrator.setorientationlocked(true);             integrator.setbeepenabled(true);             integrator.setcaptureactivity(captureactivityportrait.class);             integrator.initiatescan(); 

finally, @ androidmaifest add

   <activity         android:name=".custom.captureactivityportrait"         android:screenorientation="portrait" <---this important line         android:statenotneeded="true"         android:theme="@style/zxing_capturetheme"         android:windowsoftinputmode="statealwayshidden">     </activity> 

Comments