use of org.odk.collect.android.widgets.interfaces.BinaryWidget in project collect by opendatakit.
the class ODKView method setBinaryData.
/**
* Called when another activity returns information to answer this question.
*/
public void setBinaryData(Object answer) {
boolean set = false;
for (QuestionWidget q : widgets) {
if (q instanceof BinaryWidget) {
BinaryWidget binaryWidget = (BinaryWidget) q;
if (binaryWidget.isWaitingForData()) {
try {
binaryWidget.setBinaryData(answer);
binaryWidget.cancelWaitingForData();
} catch (Exception e) {
Timber.e(e);
ToastUtils.showLongToast(getContext().getString(R.string.error_attaching_binary_file, e.getMessage()));
}
set = true;
break;
}
}
}
if (!set) {
Timber.w("Attempting to return data to a widget or set of widgets not looking for data");
}
}
use of org.odk.collect.android.widgets.interfaces.BinaryWidget in project collect by opendatakit.
the class ODKView method cancelWaitingForBinaryData.
public void cancelWaitingForBinaryData() {
int count = 0;
for (QuestionWidget q : widgets) {
if (q instanceof BinaryWidget) {
if (q.isWaitingForData()) {
q.cancelWaitingForData();
++count;
}
}
}
if (count != 1) {
Timber.w("Attempting to cancel waiting for binary data to a widget or set of widgets " + "not looking for data");
}
}
Aggregations