Moved code from MainActivity to the ValidateByQRCode.