I am new in android app Development my task is to upload data to localhost server that a user will (fill a form & press submit button to) upload.Tell also if any library is needed.
thanks in advance.
I am new in android app Development my task is to upload data to localhost server that a user will (fill a form & press submit button to) upload.Tell also if any library is needed.
thanks in advance.
Are you using an HTML page? If so it is like a normla html page where you have a form with your fields and a submit button. If you have, instead, a UI and wants to upload the data to a remove server there are several options:
If you want to do it 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 is = con.getInputStream(); byte[] b = new byte[1024]; while ( is.read(b) != -1) buffer.append(new String(b)); con.disconnect(); Hope it helps you! If you like i wrote a post about it in my blog