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. Invalid LayoutParams supplied to android.widget.TableRow

Hi guys,
I'm tying to figure out with this problem: I would programmatically
add rows to my TableLayout; here's the code:

                TextView tv_name = new TextView(this);
                tv_name.setLayoutParams(new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.FILL_PARENT,
                        LinearLayout.LayoutParams.WRAP_CONTENT));
                tv_name.setText(step_name);

                TextView tv_done = new TextView(this);
                tv_name.setLayoutParams(new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.FILL_PARENT,
                        LinearLayout.LayoutParams.WRAP_CONTENT));
                tv_done.setAlignment(Layout.Alignment.ALIGN_OPPOSITE);
                tv_done.setText(done);

                TableRow tr = new TableRow(this);
                tr.setLayoutParams(new TableRow.LayoutParams(
                                TableRow.LayoutParams.FILL_PARENT,
                                TableRow.LayoutParams.WRAP_CONTENT));

                tr.addView(tv_name);
                tr.addView(tv_done);

                tl.addView(tr);

I've tried everything, but nothings works! Thank you!
--~--~---------~--~----~------------~-------~--~----~

2. webview not showing data

hi,

im writing a bare bones application on android...and my webview doesnt
seem to work.  i mean its not showing any data on the emulator screen.
the textview and editview all work fine..but the webview doesnt show
any data on screen. am i missing something?

 below is the part of the code that is relevant

public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        setContentView(R.layout.login);
        WebView wView = (WebView) findViewById(R.id.wview);
        wView.loadData(
                "<html><body>Please click </body></html>",
                "text/html", "utf-8");

}

my login.xml looks like this
------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Username"
    />
<EditText android:id="@+id/username"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Password"
    />
<EditText android:id="@+id/password"
        android:password="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
<Button android:id="@+id/login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Login"
        />

<WebView
        android:id="@+id/wview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:focusable="false"/>

</LinearLayout>

thanx
--~--~---------~--~----~------------~-------~--~----~

3. About useaudio

4. Wer U At Android Application

5. Removing a database or its table

6. how to get one row's Uri in one SQLite table?

7. I need a xml file