android - getting java.io.FileNotFoundException for httpURLConnection -


i trying implement simple login window giving file not found exception.... have searched lot on not running...

protected string doinbackground(string... voids) {

    try {         thread.sleep(4000);     } catch (interruptedexception e) {         e.printstacktrace();     }     string type=voids[0];      string url="http://192.168.0.105/rootlogin.php";     if(type.equals("initlogin")){         try {             string un=voids[1];             string up=voids[2];             url u=new url(url);             httpurlconnection huc= (httpurlconnection) u.openconnection();             huc.setrequestmethod("post");             huc.setdooutput(true);              huc.setdoinput(true);             outputstream os=huc.getoutputstream();             bufferedwriter bw=new bufferedwriter(new outputstreamwriter(os,"utf-8"));             string post_data= urlencoder.encode("un","utf-8")+"="+urlencoder.encode(un,"utf-8")+"&"+                     urlencoder.encode("up","utf-8")+"="+urlencoder.encode(up,"utf-8");             bw.write(post_data);             bw.flush();             bw.close();             os.close();              inputstream is=huc.getinputstream();             //inputstream error = huc.geterrorstream();             bufferedreader br=new bufferedreader(new inputstreamreader(is,"iso-8859-1"));             string result="";             string line="";             while ((line=br.readline())!=null){                 result +=line;             }              br.close();             is.close();             huc.disconnect();             return result;         } catch (malformedurlexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }     }     return null; } 

odds php file not located in root directory of server. check file path , correct url.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -