we can call use the zxing bar code reader in our app ...try this
package com.resource;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class BarcodeScan extends Activity implements OnClickListener {
private Button Scan;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barcodescan);
Scan =(Button) findViewById(R.id.scan);
Scan.setOnClickListener(this);
}
public void onClick(View v)
{
switch (v.getId()) {
case R.id.scan:
Intent intent = new
Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
break;
}
};
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
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en