hello

im having a bit of trouble displaying the results of a bar code scan
in a EditText box please can you help

here is what i have

package com.android.app;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


        public class Scanner extends Activity {


                EditText barcode1;



            /** Called when the activity is first created. */
            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.scanner);}


                public Button.OnClickListener scan1 = new
Button.OnClickListener() {
                    public void onClick(View v) {
                        Intent intent = new
Intent("com.google.zxing.client.android.SCAN");
        
intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE",
"ONE_D_MODE");
                        startActivityForResult(intent, 0);
                    }
                };


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

                                                
barcode1.setText(getString(contents));
                        }
                    }
                }



            }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to