El escáner de código de barras no devuelve el resultado a mi código / aplicación

I have integrated the zxing application into my code as it is given in this link http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/, now i don't need to install the barcode application (ZXing). Now the problem that i'm facing is on button click barcode is scanned but result is not returned to my application/code. The code is:

 Intent intent = new Intent();
    intent.setClass(com.smartcloud.MediScanActivity.this, CaptureActivity.class);
    intent.putExtra("SCAN_MODE", "ONE_D_MODE");
    startActivityForResult(intent, 0);

 public void onActivityResult(int requestCode, int resultCode, Intent intent){
        if (requestCode == 0){
            if (resultCode == RESULT_OK ) {
                 contents = intent.getStringExtra("SCAN_RESULT");
                 format = intent.getStringExtra("SCAN_RESULT_FORMAT");
                // Handle successful scan

can anybody help to show me what mistake i am doing.

preguntado el 08 de noviembre de 11 a las 11:11

Well I have the same code in my app, however I have installed ZXing app, and It works flawlessly without problem. So it must be problem with the integration in Eclipse in that link you provided propably... -

yes if ZXing is installed in phone then this code is functioning fine but according to my project requirement i don't want ZXing appln to install first to run my appln. -

1 Respuestas

You are mixing up two very different things. You are trying to scan by Intent here, but, you have also tried to embed the code in your app. I think that if you're new enough to this area and Android development, you should stick with Intents. This is not how you invoke one of your own activities.

respondido 08 nov., 11:18

thanks for your guidance, yes i am new mobile development. Can you please tell me what should i write in intent to make it work, since i cannot ask user to install ZXing before using my application - prateek

It sounds like you want to develop your own barcode scanning application. It sounds like you don't have nearly the required experience to do that. That's the problem. Don't solve the problem by copying-and-pasting almost all of our app just to solve your need; in fact, copying too much of the UI could infringe our trademark rights. You need a more experienced Android developer to do this, or you should just use Intent to scan. - Sean Owen

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.