Bonjour, j'essaye d'utiliser la librairie zxing pour scanner des QR code. Voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
    public void scanbarcode(View v) {
        Log.i(APP_TAG, "Scan!");
        Intent scanIntent = new Intent("com.google.zxing.client.android.SCAN");
        PackageManager packageManager = this.getPackageManager();
        List<ResolveInfo> activities = packageManager.queryIntentActivities(scanIntent, 0);
        if(activities.size() > 0){
            Log.i(APP_TAG, "StartActivity Scan!");
            this.startActivityForResult(scanIntent, BARCODE_SCANNED);
        }
 
    }
 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        ImageView imageView = (ImageView)this.findViewById(R.id.showphoto);
        Log.i(APP_TAG, "MainActivity1.onActivityResult(): debut !");
        Log.i(APP_TAG, "requestCode="+requestCode);
        Log.i(APP_TAG, "resultCode="+resultCode);
 
        if (requestCode == BARCODE_SCANNED) {
            Log.i(APP_TAG, "On recupere un code barre");
            String code = data.getStringExtra("SCAN_RESULT");
            Log.i(APP_TAG, "-> "+code);
            this.tv = (TextView) this.findViewById(R.id.barCodeResult);
            this.tv.setText(code);
        }
    }
Mais cela ne marche pas. Normalement cela devroit prendre une photo du bar code. Est ce exact ? De plus ma méthode onActivityResult n'est pas appelée. Je n'ai aucun log


Voici les logs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
07-03 12:27:34.153 11275-11275/com.example.admin.projetcnam W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=465.41382, y[0]=541.23047, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=62469868, downTime=60062012, deviceId=0, source=0x1002 }
07-03 12:27:34.153 11275-11275/com.example.admin.projetcnam W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=465.41382, y[0]=541.23047, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=62469868, downTime=60062012, deviceId=0, source=0x1002 }
07-03 12:27:34.153 11275-11275/com.example.admin.projetcnam W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=465.41382, y[0]=541.23047, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=62469868, downTime=60062012, deviceId=0, source=0x1002 }
07-03 12:27:34.153 11275-11275/com.example.admin.projetcnam W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=465.41382, y[0]=541.23047, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=62469868, downTime=60062012, deviceId=0, source=0x1002 }
07-03 12:27:34.315 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: Scan!
07-03 12:27:34.318 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: StartActivity Scan!
07-03 12:27:34.363 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onPause(): beginning !
07-03 12:27:34.363 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onPause(): end !
07-03 12:27:34.425 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onCreate(): beginning !
07-03 12:27:34.462 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onCreate(): premier démarrage ca passe!
07-03 12:27:34.471 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onCreate(): end !
07-03 12:27:34.472 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onStart(): beginning !
07-03 12:27:34.472 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onStart(): end !
07-03 12:27:34.472 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onResume(): beginning !
07-03 12:27:34.472 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onResume(): end !
07-03 12:27:34.670 11275-11332/com.example.admin.projetcnam W/EGL_emulation: eglSurfaceAttrib not implemented
07-03 12:27:34.670 11275-11332/com.example.admin.projetcnam W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f9fb74e6580, error=EGL_SUCCESS
07-03 12:27:35.047 11275-11332/com.example.admin.projetcnam E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f9fc88a43b0
07-03 12:27:35.051 11275-11332/com.example.admin.projetcnam D/OpenGLRenderer: endAllStagingAnimators on 0x7f9fb74dd800 (RippleDrawable) with handle 0x7f9fb79786e0
07-03 12:27:35.336 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onSaveInstanceState(): beginning !
07-03 12:27:35.338 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onSaveInstanceState(): end !
07-03 12:27:35.340 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onStop(): beginning !
07-03 12:27:35.340 11275-11275/com.example.admin.projetcnam I/CNAM_NFA025_TAG: MainActivity1.onStop(): end !
Merci d'avance pour vos réponses