【发布时间】:2016-03-18 07:39:54
【问题描述】:
您好,我从 QR 代码中扫描到包含 DateTime 的数据。但现在我想在哪里进行验证,当代码仅扫描日期和时间时,代码将继续进行另一个活动。我把代码贴在这里
Log.i("<<<<<<Asset Code>>>>> ",
"<<<<Bar Code>>> " + sym.getData());
scanResult = sym.getData().trim();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
if(scanResult.equals(dateFormat))
{
new createClockIn().execute();
}
else {
Toast.makeText(BarcodeScanner.this, "Sorry this is not a valid date and time", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), BarcodeScanner.class);
intent.putExtra("username", staffIDStr1);
startActivity(intent);
}
但是当我用日期和时间扫描二维码时,这似乎是错误的,它会弹出吐司。数据应该像这样插入到数据库中
【问题讨论】:
-
scanResult 是什么类型的?字符串
标签: android