Explanation:
I have a simple Android application, and also a NodeJS server. I have the following permissions on AndroidManifest.xml
of my application:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
I am trying to perform an HTTP Post and a Local URL, but this generates an unknown error: null
, when running HTTP Post. So I have no way of knowing what's going on.
I've checked LogCat but no errors, only this error null
of my Exception is showing up.
Here is the HTTP Post code:
HttpPost post = new HttpPost("http://192.168.25.32:8080/signup");
HttpParams params = new BasicHttpParams(); //eu estava usando Params, agora uso Pairs
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("name", "Teste2"));
pairs.add(new BasicNameValuePair("email", "[email protected]"));
pairs.add(new BasicNameValuePair("country", "Brazil"));
pairs.add(new BasicNameValuePair("user", "teste"));
pairs.add(new BasicNameValuePair("pass", "123456"));
post.setEntity(new UrlEncodedFormEntity(pairs));
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(post); //aqui vai para a Exception
Question:
What am I doing wrong? How can I solve this problem?
I would also like to know why this error is being generated.
Note:
When accessing http://192.168.25.32:8080/signup
I have a html form of registration running right, hence the to know that my NodeJS server is communicating right, and working, so I'm sure the error is in Android.