我被添加了buttonNext
,然后设置了onClicklistener
。当单击按钮并且条形码与Firestore中的条形码相同时,则使用Intent to ViewData类,问题是当单击按钮并且条形码与Firestore中的条形码不同时,它不能用于{{1} }类。
代码:
AddItems
var isBarCodeAvailable = false
for (queryDocumentSnapshot in task.getResult()) {
if (queryDocumentSnapshot.getString("barCode") != null) {
isBarCodeAvailable = true
break
} else {
isBarCodeAvailable = false
break
}
}
if (isBarCodeAvailable) {
collectionReference.document(queryDocumentSnapshot.getId())
.update("productQuantity",FieldValue.increment(1))
val moveView = Intent(this@ScannersActivity,ViewData::class.java)
moveView.putExtra("documentID",documentID)
startActivity(moveView)
finish()
} else {
val moveCode = Intent(this@ScannersActivity,AddItems::class.java)
moveCode.putExtra("sendDocumentID",documentID)
moveCode.putExtra("ScanResult",scanResult)
startActivity(moveCode)
finish()
}