my app keeps force closing before it starts... eclipse returns no errors in my code and my xml is good. can anybody give me some insight?
package com.mhe.test.scan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button myScanButton = (Button) findViewById(R.id.myScanButton);
myScanButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
}
});
}
EditText totalbox = (EditText) findViewById(R.id.totalbox);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
// Handle successful scan
totalbox.setText(contents);
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
totalbox.setText("@string/bummer");
}
}
}
}
essentially it is supposed to call zxing Barcode Scanner to scan a barcode on a button click and return the result into an EditText field... i'm a total newbie at this...