You'll have to bear with me, I'm very new to Android and my Java skills are "rusty" at best.
I was pretty excited to get the barcode scan bit working with very little effort indeed, but the camera side of things really isn't proving as easy.
I've got a main Activity class that calls for a barcode when it starts up;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button cameraButton = (Button) findViewById(R.id.cameraButton);
cameraButton.setOnClickListener( new OnClickListener(){
public void onClick(View v ){
IntentIntegrator.initiateScan(MakroDroidActivity.this, "Please scan order barcode", "Please scan a valid order barcode", "Yes", "No");
}
});
}
Working so far and I correctly handle the intent as shown:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode) {
case IntentIntegrator.REQUEST_CODE: {
if (resultCode != RESULT_CANCELED) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (scanResult != null) {
String upc = scanResult.getContents();
if (upc.startsWith("ORD"))
{
//we have a valid order barcode
Camera cam = Camera.open();
cam.takePicture(shutterCallback, rawCallback, jpegCallback);
}
else
{
IntentIntegrator.initiateScan(MakroDroidActivity.this, "Please scan again", "Please scan a valid order barcode", "Yes", "No");
}
}
}
break;
}
}
}
I have the call backs set up (currently with no code in them) but after the barcode is scanned, the device just displays a black screen. I then need to restart the device after debugging the app because the camera is no longer available (I suspect that I have not cleaned up my reference so the camera is locked to my app)
Can somebody explain to me how I go about using the camera and saving the output to the SD card (I'm planning on using a specific folder on the SD card with something like:
filepath = filepath + UUID.randomUUID().toString() + ".jpg";
to save a new, non-conflicting filename to the folder.
(Device is a T-Mobile pulse mini (Huawei manufactured I believe) and I have seen other people say there are driver issues with the camera but I am more inclined to believe it is a lack of my understanding rather than a hardware issue.)
Thanks in advance for any assistance you can give on this.