database - Trying to verify person specific url then bring up login screen in Android -
i'm trying make application person connects specific website , can access data it. first page asks them put in url. parse , need verify url's existence can move them login screen. how go doing this? i'm trying httpurlconnections i'm not having luck. thoughts?
try below code :
try { int status = 0; try { httpurlconnection httpconnection = (httpurlconnection) new url( "http://www.google.com").openconnection(); httpconnection.setrequestmethod("head"); log.e("statuscode",httpconnection.getresponsecode()); if ((httpconnection.getresponsecode() == 200)||(httpconnection.getresponsecode() == 302)) { status = 1; } } catch (exception ex) {} if (status == 1) { log.e("website","found"); } else { log.e("website","notfound"); } } catch (exception ex1) { log.e("error",ex1.getmessage().tostring()); }
Comments
Post a Comment