Skip to content Skip to sidebar Skip to footer

Comparing Data Read From Nfc Tag

Hi I am reading data from a NFC Tag and trying to compare it with a String but the if loop is getting failed while comparison of string.My code for reading NFC data and comparing

Solution 1:

If the problem is only with if condition try this code

if(text.toLowerCase().contains("silent")){
......
}

Solution 2:

An NDEF text record contains, before the actual text, information about the text's language and, more important, the text encoding (character set used). You should inspect those bytes to know whether the actual text is encoded in UTF-8 or UTF-16 (and use that for converting the bytes to a String).

Post a Comment for "Comparing Data Read From Nfc Tag"