As i said in the first post, sometimes it is scanned in a few seconds or it can take minutes, and not scan at all. Sometimes i have to "zoom" in out by physically moving my camera closer to or further from the image
Here is my code....
.
public class ScanActivity extends Activity {
String contents,format,filename,mode;
private Button bcButton;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan);
this.bcButton = (Button)this.findViewById(R.id.scanBCButton);
this.bcButton.getBackground().setColorFilter(Color.RED,PorterDuff.Mode.MULTIPLY);
// this.QRButton = (Button)this.findViewById(R.id.scanQRButton);
// this.QRButton.getBackground().setColorFilter(Color.RED,PorterDuff.Mode.MULTIPLY);
Bundle extras = getIntent().getExtras();
if (extras != null) {
filename = extras.getString("FILE_NAME");
mode = extras.getString("MODE");
}
}
public void ScanbuttonClickHandler(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
//intent.putExtra("SCAN_MODE","SCAN_MODE" );
startActivityForResult(intent, 0);
}
/*
public void ScanQRbuttonClickHandler(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE", "QR_CODE_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");
Intent intent2 = new Intent(getApplicationContext(), DisplayActivity.class);
intent2.putExtra("CONTENTS", contents);
intent2.putExtra("FILENAME", filename);
intent2.putExtra("MODE", mode);
if(mode.equals("update")){
startActivityForResult(intent2,8);
}else{
startActivity(intent2);
}
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
Toast toast = Toast.makeText(this, "Scan was Cancelled!",
Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP, 25, 500);
toast.show();
}
}
if(requestCode==8){
finish();
}
}
}
On Thursday, July 19, 2012 10:17:59 PM UTC+9:30, STCK wrote:
I am using an intent to "integrate" zxing into my android app (not IntentIntegrator)
I used the referenced website to create the attached code.
When i attempt to scan the code, i have varying success rates. sometimes it scans within seconds other times it takes minutes, or doesnt scan at all. i have to make the code larger or smaller in my viewfinder rectangle to get a scan
any ideas???