This is my problem:
class main extends menuActivity{
//
..
//
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == 0)
camera_barcode = INTENT.getStringExtra("SCAN_RESULT");
}
}
}
the INTENT is created in the menuActivity class:
public class menuActivity extends Activity {
public INTENT;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
//
INTENT = new Intent("com.google.zxing.client.android.SCAN");
INTENT.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(INTENT, 0);
//
}
}
The problem is that the String camera_barcode is null, can't understand why.
Q: if instead of QR_CODE_MODE I want to scan 1d barcodes? R: cameraScan.putExtra("SCAN_MODE", "PRODUCT_MODE");
Thank you!!
Finish the activity you are starting for result like this
Bundle b = new Bundle();
b.putString(key, value);
Intent i = getIntent(); //gets the intent that called this intent
i.putExtras(b);
setResult(Activity.RESULT_OK, i);
finish();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With