I am actually trying to intent my fragment to Zxing qr scanner when the button is clicked.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");// for Qr code, its
// "QR_CODE_MODE"
// instead of
// "PRODUCT_MODE"
intent.putExtra("SAVE_HISTORY", false);// this stops saving ur
// barcode in barcode
// scanner app's history
startActivityForResult(intent, 0);
The problem i am facing is that in the codes below, i am unable to get my resultCode to compare to RESULT_OK and RESULT_CANCELED. I managed to do this in an activity just fine but when i wanted to implement in my fragment class i am unable to do so.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
Log.d("onActivityResult", "Started");
if (requestCode == 0)
{
if (resultCode == RESULT_OK)
{
String contents = data.getStringExtra("SCAN_RESULT");
TextView txt_qrCode = (TextView) rootView.findViewById(R.id.txt_helloWorld);
// txt_qrCode.setText(contents);
}
else if (resultCode == RESULT_CANCELED)
{
// Handle cancel
}
}
}