android - URL finder from qr code -
i'm developing application scans qr code , displays data stored in it. open browser whenever url stored in qr code. how determine whether normal text or url stored in qr code.. tried using regular expressions or there other way? used zxing library scanning qr codes. please me out
its simple. whenever getting data qr code try below. valid url return true otherwise false.
try { httpurlconnection con = (httpurlconnection) url.openconnection(); con.setrequestmethod("head"); return (con.getresponsecode() == httpurlconnection.http_ok); } catch (exception e) { e.printstacktrace(); return false; }
also see link httpurlconnection
Comments
Post a Comment