我也在努力,我正在尝试制作一个具有移动视觉的名片阅读器,到目前为止,当检测到文本时,我正在使用实时生成的字符串检查 if 条件。
if (mText == null) {
return;
}
if(mText.getValue().contains("@") && mText.getValue().contains(".") && !mText.getValue().equals(mText.getValue().toUpperCase())){
Log.e("mTextemail",mText.getValue());
email=mText.getValue();
}
if (mText.getValue().startsWith("+")|| mText.getValue().startsWith("0")&& mText.getValue().contains("+-0123456789/-#")&& !mText.getValue().contains("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")){
Log.e("mTextphone",mText.getValue());
phone=mText.getValue();
}
if (!mText.getValue().contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ")&& !mText.getValue().contains("0123456789-/#") && !mText.getValue().contains("abcdefghijklmnopqrstuvwxyz")){
Log.e("mTextcompanyName",mText.getValue());
companyName=mText.getValue();
}if(mText.getValue().startsWith("ABCDEFGHIJKLMNOPQRSTUVWXYZ" )&& mText.getValue().endsWith("abcdefghijklmnopqrstuvwxyz")){
name=mText.getValue();
}
if(name ==null){
name="Was not specified";
}
if(email ==null){
email="Was not specified";
}
if(phone ==null){
phone="Was not specified";
}
if(companyName ==null){
companyName="Was not specified";
}
它以 70% 的准确率打印日志,也许我们可以互相帮助,而且我希望这些正确的日志显示在我使用过界面但它不起作用的活动中。如果您有任何发现的提示或技巧,请分享。