i am working on an application that involves the scanning of barcodes. So far, i have successfully get scanned the barcodes using camera preview by following the below. link https://github.com/ZBar/ZBar
However, the way it works does not really meet my needs.The example uses a camera preview. However on my project application, i have an application that allowus users to access the camera via the click of a button(Intent).
After that it converts the captured images to byte array.
Is there anyway to use enable Zbar to scan images(byte arrays) instead? Or is there anyway to use Zbar with android's camera instead of camera preview ?
Thank You.
This is my MainActivity.java which allows users to access the camera via intent.
public class MainActivity extends Activity {
Button cameraBtn;
final int REQUEST_IMAGE_CAPTURE = 1;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cameraBtn = (Button)findViewById(R.id.cameraBtn);
cameraBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, REQUEST_IMAGE_CAPTURE);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
}
}}