Integration problem ZXing via Intent

by Gustavo Costa » Thu, 19 May 2011 20:01:43 GMT


Sponsored Links
 Well, I'm trying implement a integration of zxing with my Android App.
In my app there is a MainActivity. In this MainActivity, I use a
button to execute the first block of code below. But every time when
execute the first block of code and the app read the QR Code, I
receive as resultCode the value RESULT_CANCELED in the second block.
The second block is executed as soon as the ZXing Activity is opened.
What do I doing wrong?

First Block of Code

Intent intent1 = new Intent("com.google.zxing.client.android.SCAN");
    intent1.setPackage("com.google.zxing.client.android");
    intent1.putExtra("SCAN_MODE", "ONE_D_MODE");
    startActivityForResult(intent1, 0);

Second block of code

public void onActivityResult2(int requestCode, int resultCode, Intent
intent2) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents2 = intent2.getStringExtra("SCAN_RESULT");
            String format2 =
intent2.getStringExtra("SCAN_RESULT_FORMAT");
            EditText assetMon1 = (EditText)
findViewById(R.id.assetMon1);
            assetMon1.setText(contents2);
        } else if (resultCode == RESULT_CANCELED) {
            // Every time I receive this code
        }
    }
}

-- 



Other Threads

1. ListView touch problem

Each list item in my ListView is a linkified TextView, and a regular
TextView.
The problem is that once there is a touchable item in the ListView,
the touch works only for that item, that is - only links work, but the
entire list item containing the link cannot be touch selected (only
with the trackball). I tried this also with buttons inside the list
items and the touch behavior was the same - only the button view could
be "touched".
Is there a way to make a list item touchable with touchable views
inside?

--~--~---------~--~----~------------~-------~--~----~

2. can't get progressbar and drawing to work together

Hi develeopers,
I tried really hard to get over this, but I found no solution.

I want to fetch images from web and display them on the canvas of a
view.
While doing so I need to display a progressbar, so that the user has
some idea what is going on.

In the activity that owns the view I set

requestWindowFeature(Window.FEATURE_PROGRESS)

and then in the view I call
first:
activity.setProgressBarVisibility(true);
and at every progress:
activity.setProgress(prog);

The problem is that I have to call the progress update whenever I
fetch an image from inside the onDraw method and whatever I try (from
the Handler to the Thread) the progress updates seem to be queued and
triggered alltogether when the canvas has finished rendering, which is
quite useless.

I also tried to extract the image fetching logic out of the onDraw and
show progress there (instead of in the onDraw), before calling
invalidate, but nothing changes. The progressbar updates are always
triggered at the end.

Any help is very appreciated.

Best regards,
Andrea






--~--~---------~--~----~------------~-------~--~----~

3. Email File using content provider

4. Need to implement Android for my website powered in PHP

5. Contacts.ContactMethods.POSTAL_LOCATION_LATITUDE returns email address instead of physical address

6. Lossless rotation of a jpeg image in Android (without fully decoding the image). How to?

7. Book or Tutorial on XML-based Layouts?