Get data from android app & Uploading it to localhost server -
i new in android app development task upload data localhost server user (fill form & press submit button to) upload.tell if library needed.
thanks in advance.
are using html page? if normla html page have form fields , submit button. if have, instead, ui , wants upload data remove server there several options:
- manually
- using library (okhttp or volley)
if want manually:
httpurlconnection con = (httpurlconnection) ( new url(url)).openconnection(); con.setrequestmethod("post"); con.setdoinput(true); con.setdooutput(true); con.connect(); con.getoutputstream().write( ("name=" + name).getbytes()); inputstream = con.getinputstream(); byte[] b = new byte[1024]; while ( is.read(b) != -1) buffer.append(new string(b)); con.disconnect();
hope helps you! if wrote post in my blog
Comments
Post a Comment