I am trying to connect to my own server application from an android
mobile app.
No matter how I implement it - it never connects - and it never throws
an exception - the app just stops and says: The application xxx has
stopped unexpectedly. Please try again.
Here is the implementation:
try {
HttpClient client = new DefaultHttpClient();
String getURL = new String("196.1.1.10");
HttpPost post = new HttpPost(getURL);
// StringEntity reqEntity = new StringEntity("/?question=what");
// reqEntity.setContentType("application/x-www-form-
urlencoded"); // just more things to try
post.setEntity(reqEntity);
HttpResponse responseGet = client.execute(post);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
//do something with the response
}
} catch (Exception e) {
login_error=true;
login_err=new String(e.getMessage());
}
I have even tried something similar with Sockets - and it bombs out in
the same way.
I have this line in my AndroidManifest.xml file:
<uses-permission android:name= "android.permission.INTERNET" />
Please help.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en