Skip to content Skip to sidebar Skip to footer

Send A String To A Servlet From Android

I am trying to send a string from a android application to a servlet and then retrieve that string to my android application ,but when i try to invoke the servlet it force close on

Solution 1:

You need to add the internet access permission

<uses-permissionandroid:name="android.permission.INTERNET"/>

I found that you should use the URLEncoder to encode the url because your url contains spaces. Please check http://developer.android.com/reference/java/net/URLEncoder.html

Solution 2:

You have forgot to set param1 from your android app.

connection.setRequestProperty("param1", "Your String Value");

then you will get the value back as response from Servlet.

Post a Comment for "Send A String To A Servlet From Android"