I have created an application that presents the user with a dialog fragment with two options: Yes
and No
.
Should the user select 'Yes', the app will call a Zxing barscan application that is installed on the device, and return the result.
Now, I have a proof of concept for this working. However this proof of concept uses a simple Activity. Therefore I can achieve this Barscan result using activity, not with Dialog Fragment.
The code used in the proof of concept is as follows:
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
//retrieve scan result
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) {
String scanContent = scanningResult.getContents();
String scanFormat = scanningResult.getFormatName();
formatTxt.setText("FORMAT: " + scanFormat);
contentTxt.setText("CONTENT: " + scanContent);
}
else{
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
This code will not work with a dialog fragment. I have been searching and came upon this question.
However it will not integrate, as I cannot access the requestCode, resultCode, or intent required, and am quite confused as to how to do so.